Re: [PATCH] usb: gadget: dummy: don't disconnect on gadget removal

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

 



On Wed, 18 Apr 2012 16:05:11 -0400 (EDT), Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 18 Apr 2012, Felipe Balbi wrote:
> 
> > > You'd be right except for one thing: You listed the code from
> > > udc-core.c:usb_gadget_remove_driver() wrongly.  In my tree it actually
> > > looks like this:
> > > 
> > > 	if (udc_is_newstyle(udc)) {
> > > 		udc->driver->disconnect(udc->gadget);
> > > 		udc->driver->unbind(udc->gadget);
> > > 		usb_gadget_udc_stop(udc->gadget, udc->driver);
> > > 		usb_gadget_disconnect(udc->gadget);
> > > 	} else {
> > > 		usb_gadget_stop(udc->gadget, udc->driver);
> > > 	}
> > > 
> > > Notice the relative order of the usb_gadget_disconnect() and 
> > > usb_gadget_udc_stop() calls.  This hasn't been changed since 3.4-rc2, 
> > > has it?  I hope not -- if it has changed then it is now wrong.
> > 
> > you need to fetch Greg's usb-linus branch ;-)
> 
> In fact I have it -- the code listed above is the most recent version
> in the usb-linus branch.
> 
> (Argh!  It turns out one of my scripts needs to be fixed.  It depends
> on there not being any tags reachable from the main linus branch other
> than the vX.Y and vX.Y-rcN tags created by Linus himself.  But now
> Greg's usb-X.Y-rcN tags are there too.  That fooled me into thinking I
> was using 3.4-rc2 with only slight additions when in fact I was using
> usb-3.4-rc2 with slight additions.  I'll have to restrict the script to
> match only tag names beginning with 'v'.)
> 
> Anyway, apparently Alexander hasn't gotten commit
> 8ae8090c82eb407267001f75b3d256b3bd4ae691 (usb: gadget: udc-core: fix
> asymmetric calls in remove_driver) yet.  Presumably that will take care
> of his problem.

I have, and that's how I found the initial problem. Before this patch,
udc_stop() gets called first, sets the dum->driver = NULL (also calls
pullup(), which with the dum->driver being NULL doesn't do any harm), so
that when usb_gadget_disconnect() calls pullup(), it again won't do any
harm due to dum->driver being NULL.

But after this patch, there's a problem.

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux