From: deraadt Date: Sun, 18 Aug 2024 03:25:04 +0000 (+0000) Subject: add missing child activate handling, found due to idiom inspection X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=07e9317caff2fb037172176fa6113868d345aa5c;p=openbsd add missing child activate handling, found due to idiom inspection tested by phessler, input from kettenis --- diff --git a/sys/dev/i2c/iatp.c b/sys/dev/i2c/iatp.c index 7c233dede09..701289d3d31 100644 --- a/sys/dev/i2c/iatp.c +++ b/sys/dev/i2c/iatp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iatp.c,v 1.9 2022/04/06 18:59:28 naddy Exp $ */ +/* $OpenBSD: iatp.c,v 1.10 2024/08/18 03:25:04 deraadt Exp $ */ /* * Atmel maXTouch i2c touchscreen/touchpad driver * Copyright (c) 2016 joshua stein @@ -295,9 +295,11 @@ int iatp_activate(struct device *self, int act) { struct iatp_softc *sc = (struct iatp_softc *)self; + int rv; switch (act) { case DVACT_QUIESCE: + rv = config_activate_children(self, act); #if 0 /* XXX: causes dwiic troubles */ iatp_t7_set_power_mode(sc, MXT_T7_POWER_MODE_DEEP_SLEEP); @@ -307,12 +309,13 @@ iatp_activate(struct device *self, int act) sc->sc_busy = 1; iatp_init(sc); sc->sc_busy = 0; + rv = config_activate_children(self, act); + break; + default: + rv = config_activate_children(self, act); break; } - - config_activate_children(self, act); - - return 0; + return rv; } int diff --git a/sys/dev/i2c/ietp.c b/sys/dev/i2c/ietp.c index 353eb9073d9..fac002babfa 100644 --- a/sys/dev/i2c/ietp.c +++ b/sys/dev/i2c/ietp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ietp.c,v 1.2 2023/07/21 02:19:49 jcs Exp $ */ +/* $OpenBSD: ietp.c,v 1.3 2024/08/18 03:25:04 deraadt Exp $ */ /* * Elan I2C Touchpad driver * @@ -304,11 +304,13 @@ int ietp_activate(struct device *self, int act) { struct ietp_softc *sc = (struct ietp_softc *)self; + int rv; DPRINTF(("%s(%d)\n", __func__, act)); switch (act) { case DVACT_QUIESCE: + rv = config_activate_children(self, act); sc->sc_dying = 1; if (ietp_set_power(sc, I2C_HID_POWER_OFF)) printf("%s: failed to power down\n", @@ -317,12 +319,13 @@ ietp_activate(struct device *self, int act) case DVACT_WAKEUP: ietp_reset(sc); sc->sc_dying = 0; + rv = config_activate_children(self, act); + break; + default: + rv = config_activate_children(self, act); break; } - - config_activate_children(self, act); - - return 0; + return rv; } void diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index d028930347a..a735b015f7f 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.29 2023/08/12 10:03:05 kettenis Exp $ */ +/* $OpenBSD: ihidev.c,v 1.30 2024/08/18 03:25:04 deraadt Exp $ */ /* * HID-over-i2c driver * @@ -233,11 +233,13 @@ int ihidev_activate(struct device *self, int act) { struct ihidev_softc *sc = (struct ihidev_softc *)self; + int rv; DPRINTF(("%s(%d)\n", __func__, act)); switch (act) { case DVACT_QUIESCE: + rv = config_activate_children(self, act); sc->sc_dying = 1; if (sc->sc_poll && timeout_initialized(&sc->sc_timer)) { DPRINTF(("%s: cancelling polling\n", @@ -254,12 +256,13 @@ ihidev_activate(struct device *self, int act) sc->sc_dying = 0; if (sc->sc_poll && timeout_initialized(&sc->sc_timer)) timeout_add(&sc->sc_timer, 2000); + rv = config_activate_children(self, act); + break; + default: + rv = config_activate_children(self, act); break; } - - config_activate_children(self, act); - - return 0; + return rv; } void