Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c In axppmic_power_poweroff(), check for errors fr...
details: https://anonhg.NetBSD.org/src/rev/2cb89b3a7dc8
branches: trunk
changeset: 1005850:2cb89b3a7dc8
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Dec 23 14:34:23 2019 +0000
description:
In axppmic_power_poweroff(), check for errors from iic_acquire_bus()
before proceeding with writing to the device.
diffstat:
sys/dev/i2c/axppmic.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (42 lines):
diff -r 949888fb93c7 -r 2cb89b3a7dc8 sys/dev/i2c/axppmic.c
--- a/sys/dev/i2c/axppmic.c Mon Dec 23 14:26:19 2019 +0000
+++ b/sys/dev/i2c/axppmic.c Mon Dec 23 14:34:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.27 2019/12/23 02:57:32 thorpej Exp $ */
+/* $NetBSD: axppmic.c,v 1.28 2019/12/23 14:34:23 thorpej Exp $ */
/*-
* Copyright (c) 2014-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.27 2019/12/23 02:57:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.28 2019/12/23 14:34:23 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -557,12 +557,20 @@
axppmic_power_poweroff(device_t dev)
{
struct axppmic_softc *sc = device_private(dev);
+ int error;
delay(1000000);
- iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
- axppmic_write(sc->sc_i2c, sc->sc_addr, AXP_POWER_DISABLE_REG, AXP_POWER_DISABLE_CTRL, I2C_F_POLL);
- iic_release_bus(sc->sc_i2c, I2C_F_POLL);
+ error = iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
+ if (error == 0) {
+ error = axppmic_write(sc->sc_i2c, sc->sc_addr,
+ AXP_POWER_DISABLE_REG, AXP_POWER_DISABLE_CTRL, I2C_F_POLL);
+ iic_release_bus(sc->sc_i2c, I2C_F_POLL);
+ }
+ if (error) {
+ device_printf(dev, "WARNING: unable to power off, error %d\n",
+ error);
+ }
}
static struct fdtbus_power_controller_func axppmic_power_funcs = {
Home |
Main Index |
Thread Index |
Old Index