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
This commit is contained in:
parent
66ff8ddf7e
commit
fe1c24e3d6
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user