Index: sys/dev/usb/usb_hub.c =================================================================== --- sys/dev/usb/usb_hub.c (revision 349802) +++ sys/dev/usb/usb_hub.c (working copy) @@ -2274,18 +2274,19 @@ } /*------------------------------------------------------------------------* - * usb_needs_explore_all + * usb_needs_explore_all_flags * * This function is called whenever a new driver is loaded and will * cause that all USB buses are re-explored. *------------------------------------------------------------------------*/ -void -usb_needs_explore_all(void) +static void +usb_needs_explore_all_flags(int flags) { struct usb_bus *bus; devclass_t dc; device_t dev; int max; + int x; DPRINTFN(3, "\n"); @@ -2297,9 +2298,9 @@ /* * Explore all USB buses in parallel. */ - max = devclass_get_maxunit(dc); - while (max >= 0) { - dev = devclass_get_device(dc, max); + max = devclass_get_maxunit(dc) + 1; + for (x = 0; x < max; x++) { + dev = devclass_get_device(dc, x); if (dev) { bus = device_get_softc(dev); if (bus) { @@ -2306,10 +2307,17 @@ usb_needs_explore(bus, 1); } } - max--; + if (flags & 1) + pause("W", hz / max); } } +void +usb_needs_explore_all(void) +{ + usb_needs_explore_all_flags(0); +} + /*------------------------------------------------------------------------* * usb_needs_explore_init * @@ -2324,7 +2332,7 @@ * being called: */ if (cold == 0) - usb_needs_explore_all(); + usb_needs_explore_all_flags(1); else DPRINTFN(-1, "Cold variable is still set!\n"); }