Author: avg
Date: Fri Oct 18 12:34:30 2019
New Revision: 353727
URL: https://svnweb.freebsd.org/changeset/base/353727

Log:
  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

Modified:
  head/sys/dev/gpio/gpioiic.c

Modified: head/sys/dev/gpio/gpioiic.c
==============================================================================
--- head/sys/dev/gpio/gpioiic.c Fri Oct 18 12:32:01 2019        (r353726)
+++ head/sys/dev/gpio/gpioiic.c Fri Oct 18 12:34:30 2019        (r353727)
@@ -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),
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to