Re: [PATCH 02/49] usb: gadget: udc-core: initialize gadget->dev.driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Feb 26, 2013 at 10:55:40AM -0500, Alan Stern wrote:
> On Tue, 26 Feb 2013, Felipe Balbi wrote:
> 
> > if we initialize gadget->dev.driver ourselves,
> > UDC drivers won't have to do the same, so we
> > can remove some duplicated code.
> > 
> > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> 
> There's something odd going on here that I don't understand...
> 
> > @@ -296,6 +297,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
> >  
> >  	udc->driver = driver;
> >  	udc->dev.driver = &driver->driver;
> > +	udc->gadget->dev.driver = &driver->driver;
> 
> Why is the same pointer assigned as the driver of two different
> devices?
> 
> The assignment to udc->gadget->dev.driver looks reasonable, since here
> "driver" really is a usb_gadget_driver.  But it's not a UDC driver, so
> why do we have the first two lines above?
> 
> At best they are redundant.  More likely they are either wrong or 
> unnecessary.

udc->dev.driver assignment looks unnecessary, indeed, but udc->driver is
needed. We're using that to know that this particular UDC is busy
already. Look at the uses of udc->driver in
drivers/usb/gadget/udc-core.c

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux