*** dev/iicbus/iicbb.c.ORIGINAL Sun Aug 24 13:49:13 2003 --- dev/iicbus/iicbb.c Fri Jul 1 15:55:21 2005 *************** struct iicbb_softc { *** 66,71 **** --- 66,72 ---- static int iicbb_probe(device_t); static int iicbb_attach(device_t); static int iicbb_detach(device_t); + static void iicbb_child_detached(device_t, device_t); static int iicbb_print_child(device_t, device_t); static int iicbb_callback(device_t, int, caddr_t); *************** static device_method_t iicbb_methods[] = *** 82,87 **** --- 83,89 ---- DEVMETHOD(device_detach, iicbb_detach), /* bus interface */ + DEVMETHOD(bus_child_detached, iicbb_child_detached), DEVMETHOD(bus_print_child, iicbb_print_child), /* iicbus interface */ *************** static int iicbb_attach(device_t dev) *** 130,144 **** static int iicbb_detach(device_t dev) { struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); ! if (sc->iicbus) { ! bus_generic_detach(dev); ! device_delete_child(dev, sc->iicbus); ! } return (0); } static int iicbb_print_child(device_t bus, device_t dev) { --- 132,165 ---- static int iicbb_detach(device_t dev) { struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); + device_t child; ! /* ! * Detach the children before recursively deleting ! * in case a child has a pointer to a grandchild ! * which is used by the child's detach routine. ! * ! * Remember the child before detaching so we can ! * delete it (bus_generic_detach indirectly zeroes ! * sc->child_dev). ! */ ! child = sc->iicbus; ! bus_generic_detach(dev); ! if (child) ! device_delete_child(dev, child); return (0); } + static void + iicbb_child_detached( device_t dev, device_t child ) + { + struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); + + if (child == sc->iicbus) + sc->iicbus = NULL; + } + static int iicbb_print_child(device_t bus, device_t dev) { *************** static int iicbb_read(device_t dev, char *** 383,388 **** --- 404,410 ---- } DRIVER_MODULE(iicbb, bktr, iicbb_driver, iicbb_devclass, 0, 0); + DRIVER_MODULE(iicbb, cxm_iic, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, lpbb, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, viapm, iicbb_driver, iicbb_devclass, 0, 0); *** dev/iicbus/iicbus_if.m.ORIGINAL Wed Apr 13 14:25:01 2005 --- dev/iicbus/iicbus_if.m Mon Oct 24 00:51:05 2005 *************** METHOD int read { *** 90,96 **** # METHOD int write { device_t dev; ! char *buf; int len; int *bytes; int timeout; --- 90,96 ---- # METHOD int write { device_t dev; ! const char *buf; int len; int *bytes; int timeout; *** dev/iicbus/iiconf.h.ORIGINAL Wed Jun 16 22:51:57 2004 --- dev/iicbus/iiconf.h Mon Oct 24 00:43:41 2005 *************** extern int iicbus_started(device_t); *** 114,120 **** extern int iicbus_start(device_t, u_char, int); extern int iicbus_stop(device_t); extern int iicbus_repeated_start(device_t, u_char, int); ! extern int iicbus_write(device_t, char *, int, int *, int); extern int iicbus_read(device_t, char *, int, int *, int, int); /* single byte read/write functions, start/stop not managed */ --- 114,120 ---- extern int iicbus_start(device_t, u_char, int); extern int iicbus_stop(device_t); extern int iicbus_repeated_start(device_t, u_char, int); ! extern int iicbus_write(device_t, const char *, int, int *, int); extern int iicbus_read(device_t, char *, int, int *, int, int); /* single byte read/write functions, start/stop not managed */ *** dev/iicbus/iiconf.c.ORIGINAL Wed Jun 16 22:51:57 2004 --- dev/iicbus/iiconf.c Mon Oct 24 00:47:32 2005 *************** iicbus_stop(device_t bus) *** 234,240 **** * iicbus_start() call */ int ! iicbus_write(device_t bus, char *buf, int len, int *sent, int timeout) { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); --- 234,240 ---- * iicbus_start() call */ int ! iicbus_write(device_t bus, const char *buf, int len, int *sent, int timeout) { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);