Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Nov 2010 09:32:54 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Weongyo Jeong <weongyo@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r215812 - in head/sys/dev/usb: . controller
Message-ID:  <201011250932.54119.hselasky@c2i.net>
In-Reply-To: <201011250330.oAP3UhAG092470@svn.freebsd.org>
References:  <201011250330.oAP3UhAG092470@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 25 November 2010 04:30:43 Weongyo Jeong wrote:
> Author: weongyo
> Date: Thu Nov 25 03:30:43 2010
> New Revision: 215812
> URL: http://svn.freebsd.org/changeset/base/215812
> 
> Log:
>   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
> 
> Modified:
>   head/sys/dev/usb/controller/usb_controller.c
>   head/sys/dev/usb/usb_pf.c
> 
> Modified: head/sys/dev/usb/controller/usb_controller.c
> ===========================================================================
> === --- head/sys/dev/usb/controller/usb_controller.c	Thu Nov 25 03:16:31
> 2010	(r215811) +++ head/sys/dev/usb/controller/usb_controller.c	Thu Nov 
25
> 03:30:43 2010	(r215812) @@ -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_
>  		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 *bu
> 
>  	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_dma_tag_unsetup(bus->dma_parent_tag);
>  #endif
> 
> -	usbpf_detach(bus);
> -
>  	mtx_destroy(&bus->bus_mtx);
>  }
> 
> 
> Modified: head/sys/dev/usb/usb_pf.c
> ===========================================================================
> === --- head/sys/dev/usb/usb_pf.c	Thu Nov 25 03:16:31 2010	(r215811)
> +++ head/sys/dev/usb/usb_pf.c	Thu Nov 25 03:30:43 2010	(r215812)
> @@ -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,

Ok. This will work.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011250932.54119.hselasky>