summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorweongyo <weongyo@FreeBSD.org>2010-11-25 03:30:43 +0000
committerweongyo <weongyo@FreeBSD.org>2010-11-25 03:30:43 +0000
commitcfdc99ec6ccd5e35d343f13054cc0bc5f6d04797 (patch)
tree59d42af7022916d307450d5989d11b26b7260213 /sys/dev
parent0e804ca5ee4d874b58c1a27649258da21b2a2057 (diff)
downloadFreeBSD-src-cfdc99ec6ccd5e35d343f13054cc0bc5f6d04797.zip
FreeBSD-src-cfdc99ec6ccd5e35d343f13054cc0bc5f6d04797.tar.gz
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
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/controller/usb_controller.c8
-rw-r--r--sys/dev/usb/usb_pf.c3
2 files changed, 5 insertions, 6 deletions
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);
}
diff --git a/sys/dev/usb/usb_pf.c b/sys/dev/usb/usb_pf.c
index 16cf8d7..c2925c2 100644
--- a/sys/dev/usb/usb_pf.c
+++ b/sys/dev/usb/usb_pf.c
@@ -61,10 +61,9 @@ void
usbpf_attach(struct usb_bus *ubus)
{
struct ifnet *ifp;
- devclass_t dc = devclass_find("usbus");
ifp = ubus->ifp = if_alloc(IFT_USB);
- if_initname(ifp, "usbus", devclass_get_count(dc));
+ if_initname(ifp, "usbus", device_get_unit(ubus->bdev));
if_attach(ifp);
KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN,
OpenPOWER on IntegriCloud