summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/usb_controller.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/controller/usb_controller.c')
-rw-r--r--sys/dev/usb/controller/usb_controller.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c
index 5f28640..9e00ef5 100644
--- a/sys/dev/usb/controller/usb_controller.c
+++ b/sys/dev/usb/controller/usb_controller.c
@@ -24,6 +24,9 @@
* SUCH DAMAGE.
*/
+#ifdef USB_GLOBAL_INCLUDE_FILE
+#include USB_GLOBAL_INCLUDE_FILE
+#else
#include "opt_ddb.h"
#include <sys/stdint.h>
@@ -62,6 +65,7 @@
#include <dev/usb/usb_bus.h>
#include <dev/usb/usb_pf.h>
#include "usb_if.h"
+#endif /* USB_GLOBAL_INCLUDE_FILE */
/* function prototypes */
@@ -84,10 +88,12 @@ SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug, CTLFLAG_RW, &usb_ctrl_debug, 0,
"Debug level");
#endif
+#if USB_HAVE_ROOT_MOUNT_HOLD
static int usb_no_boot_wait = 0;
TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait);
SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RD|CTLFLAG_TUN, &usb_no_boot_wait, 0,
"No USB device enumerate waiting at boot.");
+#endif
static int usb_no_suspend_wait = 0;
TUNABLE_INT("hw.usb.no_suspend_wait", &usb_no_suspend_wait);
@@ -144,6 +150,7 @@ usb_probe(device_t dev)
return (0);
}
+#if USB_HAVE_ROOT_MOUNT_HOLD
static void
usb_root_mount_rel(struct usb_bus *bus)
{
@@ -153,6 +160,7 @@ usb_root_mount_rel(struct usb_bus *bus)
bus->bus_roothold = NULL;
}
}
+#endif
/*------------------------------------------------------------------------*
* usb_attach
@@ -169,11 +177,12 @@ usb_attach(device_t dev)
return (ENXIO);
}
+#if USB_HAVE_ROOT_MOUNT_HOLD
if (usb_no_boot_wait == 0) {
/* delay vfs_mountroot until the bus is explored */
bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
}
-
+#endif
usb_attach_sub(dev, bus);
return (0); /* return success */
@@ -196,8 +205,10 @@ usb_detach(device_t dev)
/* Stop power watchdog */
usb_callout_drain(&bus->power_wdog);
+#if USB_HAVE_ROOT_MOUNT_HOLD
/* Let the USB explore process detach all devices. */
usb_root_mount_rel(bus);
+#endif
USB_BUS_LOCK(bus);
@@ -363,7 +374,9 @@ usb_bus_explore(struct usb_proc_msg *pm)
(udev->hub->explore) (udev);
USB_BUS_LOCK(bus);
}
+#if USB_HAVE_ROOT_MOUNT_HOLD
usb_root_mount_rel(bus);
+#endif
}
/*------------------------------------------------------------------------*
@@ -630,7 +643,9 @@ usb_bus_attach(struct usb_proc_msg *pm)
default:
device_printf(bus->bdev, "Unsupported USB revision\n");
+#if USB_HAVE_ROOT_MOUNT_HOLD
usb_root_mount_rel(bus);
+#endif
return;
}
@@ -672,7 +687,9 @@ usb_bus_attach(struct usb_proc_msg *pm)
if (err) {
device_printf(bus->bdev, "Root HUB problem, error=%s\n",
usbd_errstr(err));
+#if USB_HAVE_ROOT_MOUNT_HOLD
usb_root_mount_rel(bus);
+#endif
}
/* set softc - we are ready */
OpenPOWER on IntegriCloud