aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-10-18 12:34:30 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-10-18 12:34:30 +0000
commit44a57bfe3abf43e7953813eef3a3b651dbfdd677 (patch)
treeaaa809fdcd4eb0a515a0a5532622988bb21ae446
parent47adb0e0e08e272b580d51db9c662f39f9366df7 (diff)
downloadsrc-44a57bfe3abf43e7953813eef3a3b651dbfdd677.tar.gz
src-44a57bfe3abf43e7953813eef3a3b651dbfdd677.zip
gpioiic: add the detach method
bus_generic_detach was not enough, we also need to clean up the iicbus child device. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=353727
-rw-r--r--sys/dev/gpio/gpioiic.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c
index fdd226f2414f..cad2e1b5c970 100644
--- a/sys/dev/gpio/gpioiic.c
+++ b/sys/dev/gpio/gpioiic.c
@@ -143,6 +143,15 @@ gpioiic_attach(device_t dev)
return (0);
}
+static int
+gpioiic_detach(device_t dev)
+{
+
+ bus_generic_detach(dev);
+ device_delete_children(dev);
+ return (0);
+}
+
/*
* Reset bus by setting SDA first and then SCL.
* Must always be called with gpio bus locked.
@@ -241,7 +250,7 @@ static device_method_t gpioiic_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, gpioiic_probe),
DEVMETHOD(device_attach, gpioiic_attach),
- DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_detach, gpioiic_detach),
/* iicbb interface */
DEVMETHOD(iicbb_setsda, gpioiic_setsda),