From cfdc99ec6ccd5e35d343f13054cc0bc5f6d04797 Mon Sep 17 00:00:00 2001 From: weongyo Date: Thu, 25 Nov 2010 03:30:43 +0000 Subject: Handles the unit number correctly that the previous commit had a problem (wrong unit number for a host controller) when the module is load / unloaded repeatly. Attaching the USB pf is moved to usbus device's attach. Pointed by: yongari --- sys/dev/usb/controller/usb_controller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev/usb/controller/usb_controller.c') diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c index a0b915c..d774d34 100644 --- a/sys/dev/usb/controller/usb_controller.c +++ b/sys/dev/usb/controller/usb_controller.c @@ -207,6 +207,8 @@ usb_detach(device_t dev) usb_proc_free(&bus->control_xfer_proc); + usbpf_detach(bus); + return (0); } @@ -435,6 +437,8 @@ usb_attach_sub(device_t dev, struct usb_bus *bus) usb_devclass_ptr = devclass_find("usbus"); mtx_unlock(&Giant); + usbpf_attach(bus); + /* Initialise USB process messages */ bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore; bus->explore_msg[0].bus = bus; @@ -548,8 +552,6 @@ usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, TAILQ_INIT(&bus->intr_q.head); - usbpf_attach(bus); - #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); @@ -597,8 +599,6 @@ usb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb) usb_dma_tag_unsetup(bus->dma_parent_tag); #endif - usbpf_detach(bus); - mtx_destroy(&bus->bus_mtx); } -- cgit v1.1