Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Detach led's and sysmon in our detach routine.
details: https://anonhg.NetBSD.org/src/rev/c9f6bddf5ce8
branches: trunk
changeset: 977715:c9f6bddf5ce8
user: jdc <jdc%NetBSD.org@localhost>
date: Sat Oct 31 14:39:31 2020 +0000
description:
Detach led's and sysmon in our detach routine.
diffstat:
sys/dev/i2c/pcf8574.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diffs (43 lines):
diff -r 004ba10574a7 -r c9f6bddf5ce8 sys/dev/i2c/pcf8574.c
--- a/sys/dev/i2c/pcf8574.c Sat Oct 31 14:38:54 2020 +0000
+++ b/sys/dev/i2c/pcf8574.c Sat Oct 31 14:39:31 2020 +0000
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcf8574.c,v 1.1 2020/10/29 06:55:51 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcf8574.c,v 1.2 2020/10/31 14:39:31 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -53,6 +53,7 @@
struct pcf8574_led {
void *cookie;
+ struct led_device *led;
uint8_t mask, v_on, v_off;
};
@@ -215,13 +216,19 @@
static int
pcf8574_detach(device_t self, int flags)
{
+ struct pcf8574_softc *sc = device_private(self);
+ int i;
+
+ if (sc->sc_sme != NULL)
+ sysmon_envsys_unregister(sc->sc_sme);
+
+ for (i = 0; i < sc->sc_nleds; i++)
+ led_detach(sc->sc_leds[i].led);
+
#ifdef PCF8574_DEBUG
- struct pcf8574_softc *sc = device_private(self);
-
callout_halt(&sc->sc_timer, NULL);
callout_destroy(&sc->sc_timer);
#endif
-
return 0;
}
Home |
Main Index |
Thread Index |
Old Index