diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-02-22 01:02:25 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-02-22 01:02:25 +0000 |
commit | 8f77bce477bb00fbe439b45c6729218e94d0d448 (patch) | |
tree | 43c991eb00f764be545d53010db5d1665d1e99ff /sys/dev/usb2/controller/usb2_controller.c | |
parent | 3bc203445d13de73865f2a266cf25b88c21359d1 (diff) | |
download | FreeBSD-src-8f77bce477bb00fbe439b45c6729218e94d0d448.zip FreeBSD-src-8f77bce477bb00fbe439b45c6729218e94d0d448.tar.gz |
Use root_mount_hold and root_mount_rel to allow the USB bus to be explored
before trying to mount root. Unlike USB1 the busses are not explored at attach
but rather after threads are running.
Diffstat (limited to 'sys/dev/usb2/controller/usb2_controller.c')
-rw-r--r-- | sys/dev/usb2/controller/usb2_controller.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/usb2/controller/usb2_controller.c b/sys/dev/usb2/controller/usb2_controller.c index f8d94cf..cd334ab 100644 --- a/sys/dev/usb2/controller/usb2_controller.c +++ b/sys/dev/usb2/controller/usb2_controller.c @@ -126,6 +126,10 @@ usb2_attach(device_t dev) DPRINTFN(0, "USB device has no ivars\n"); return (ENXIO); } + + /* delay vfs_mountroot until the bus is explored */ + bus->bus_roothold = root_mount_hold(device_get_nameunit(dev)); + if (usb2_post_init_called) { mtx_lock(&Giant); usb2_attach_sub(dev, bus); @@ -153,6 +157,10 @@ usb2_detach(device_t dev) usb2_callout_drain(&bus->power_wdog); /* Let the USB explore process detach all devices. */ + if (bus->bus_roothold != NULL) { + root_mount_rel(bus->bus_roothold); + bus->bus_roothold = NULL; + } USB_BUS_LOCK(bus); if (usb2_proc_msignal(&bus->explore_proc, @@ -225,6 +233,10 @@ usb2_bus_explore(struct usb2_proc_msg *pm) USB_BUS_LOCK(bus); } + if (bus->bus_roothold != NULL) { + root_mount_rel(bus->bus_roothold); + bus->bus_roothold = NULL; + } } /*------------------------------------------------------------------------* |