Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/controller/usb_controller.c
Show First 20 Lines • Show All 432 Lines • ▼ Show 20 Lines | usb_bus_detach(struct usb_proc_msg *pm) | ||||
bus = ((struct usb_bus_msg *)pm)->bus; | bus = ((struct usb_bus_msg *)pm)->bus; | ||||
udev = bus->devices[USB_ROOT_HUB_ADDR]; | udev = bus->devices[USB_ROOT_HUB_ADDR]; | ||||
dev = bus->bdev; | dev = bus->bdev; | ||||
/* clear the softc */ | /* clear the softc */ | ||||
device_set_softc(dev, NULL); | device_set_softc(dev, NULL); | ||||
USB_BUS_UNLOCK(bus); | USB_BUS_UNLOCK(bus); | ||||
/* detach children first */ | /* detach children first */ | ||||
mtx_lock(&Giant); | bus_topo_lock(); | ||||
bus_generic_detach(dev); | bus_generic_detach(dev); | ||||
mtx_unlock(&Giant); | bus_topo_unlock(); | ||||
/* | /* | ||||
* Free USB device and all subdevices, if any. | * Free USB device and all subdevices, if any. | ||||
*/ | */ | ||||
usb_free_device(udev, 0); | usb_free_device(udev, 0); | ||||
USB_BUS_LOCK(bus); | USB_BUS_LOCK(bus); | ||||
/* clear bdev variable last */ | /* clear bdev variable last */ | ||||
▲ Show 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | |||||
/*------------------------------------------------------------------------* | /*------------------------------------------------------------------------* | ||||
* usb_attach_sub | * usb_attach_sub | ||||
* | * | ||||
* This function creates a thread which runs the USB attach code. | * This function creates a thread which runs the USB attach code. | ||||
*------------------------------------------------------------------------*/ | *------------------------------------------------------------------------*/ | ||||
static void | static void | ||||
usb_attach_sub(device_t dev, struct usb_bus *bus) | usb_attach_sub(device_t dev, struct usb_bus *bus) | ||||
{ | { | ||||
mtx_lock(&Giant); | bus_topo_lock(); | ||||
if (usb_devclass_ptr == NULL) | if (usb_devclass_ptr == NULL) | ||||
usb_devclass_ptr = devclass_find("usbus"); | usb_devclass_ptr = devclass_find("usbus"); | ||||
mtx_unlock(&Giant); | bus_topo_unlock(); | ||||
#if USB_HAVE_PF | #if USB_HAVE_PF | ||||
usbpf_attach(bus); | usbpf_attach(bus); | ||||
#endif | #endif | ||||
/* Initialise USB process messages */ | /* Initialise USB process messages */ | ||||
bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore; | bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore; | ||||
bus->explore_msg[0].bus = bus; | bus->explore_msg[0].bus = bus; | ||||
bus->explore_msg[1].hdr.pm_callback = &usb_bus_explore; | bus->explore_msg[1].hdr.pm_callback = &usb_bus_explore; | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |