diff options
author | imp <imp@FreeBSD.org> | 2004-07-22 22:53:38 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2004-07-22 22:53:38 +0000 |
commit | 24a1a0bbbf77adca96cb29f3cdad3f6cf2af30d9 (patch) | |
tree | 2c2780c875e8104be1b423d8c4588cbd4292dc82 /sys | |
parent | 69e2cf0e4d2da4a251e206596c0e8d88bf4790f7 (diff) | |
download | FreeBSD-src-24a1a0bbbf77adca96cb29f3cdad3f6cf2af30d9.zip FreeBSD-src-24a1a0bbbf77adca96cb29f3cdad3f6cf2af30d9.tar.gz |
MFp4:
Improve child_detached a little and make it conform better to
style(9). Also, improve comment about what we'll be doing in the
future about driver_added. Soon it will be possible to kldload usb
drivers and have them attach w/o a need to disconnect/reconnect them.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/uhub.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 96cfdf2..37fe5c3 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -690,42 +690,41 @@ found_dev: Static void uhub_child_detached(device_t self, device_t child) { - struct uhub_softc *sc = device_get_softc(self); - usbd_device_handle devhub = sc->sc_hub; - usbd_device_handle dev; - int nports; - int port; - int i; - - if (!devhub->hub) - /* should never happen; children are only created after init */ - panic("hub not fully initialised, but child deleted?"); - - nports = devhub->hub->hubdesc.bNbrPorts; - for (port = 0; port < nports; port++) { - dev = devhub->hub->ports[port].device; - if (dev && dev->subdevs) { - for (i = 0; dev->subdevs[i]; i++) { - if (dev->subdevs[i] == child) { - dev->subdevs[i] = NULL; - return; - } - } - } - } + struct uhub_softc *sc = device_get_softc(self); + usbd_device_handle devhub = sc->sc_hub; + usbd_device_handle dev; + int nports; + int port; + int i; + + if (!devhub->hub) + /* should never happen; children are only created after init */ + panic("hub not fully initialised, but child deleted?"); + + nports = devhub->hub->hubdesc.bNbrPorts; + for (port = 0; port < nports; port++) { + dev = devhub->hub->ports[port].device; + if (dev == NULL || dev->subdevs == NULL) + continue; + for (i = 0; dev->subdevs[i]; i++) { + if (dev->subdevs[i] == child) { + dev->subdevs[i] = NULL; + return; + } + } + } } Static void uhub_driver_added(device_t _dev, driver_t *_driver) { - /* Don't do anything, as reprobing does not work currently. We should - * really call through to usbd_new_device or a function along those - * lines that reinitialises the device if it is not owned by any - * driver. But this is complicated. Manual replugging by the user is - * easier. + /* + * Don't do anything, as reprobing does not work currently. + * In the future we should properly allocate ivars so we can + * leave the devices attached to the newbus tree. Once we do + * that, then we can reprobe on driver loading with the + * default driver added routines. */ - - ; } #endif |