Re: [PATCH] drivers/usb/gadget: beautify code, delete unused code

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

 



On Thu, Mar 14, 2013 at 11:07:33AM -0400, Alan Stern wrote:
> On Thu, 14 Mar 2013, Felipe Balbi wrote:
> 
> > Hi Alan,
> > 
> > On Wed, Mar 13, 2013 at 05:53:04PM +0800, Chen Gang wrote:
> > > Hello Felipe Balbi:
> > > 
> > >   I have communicate with related member of net2272 and net2280.
> > >     net2272 and net2280 belong to PLX Tech Corporation.
> > >     they say: "PLX is not longer maintain these drivers".
> > >       (it means: they can not help us to test this patch).
> > >     please see the FWD mail at the bottom for more details.
> > > 
> > >   next:
> > >     I want to broadcast our test demand within linux-kernel@xxxxxxxxxxxxxxx.
> > >     is it suitable to do it ?
> > >     if it is suitable:
> > >       the next work flow is:
> > >         I will write a [Cooperation] patch.
> > >         and then send it to you (just reply this mail) to get a check.
> > >         and send to linux-kernel@xxxxxxxxxxxxxxx, after pass checking.
> > >       is it ok ?
> > 
> > do you have net2272 and net2280 avaiable which you could help us out
> > testing this patch ?
> 
> I have a net2280.  Which patch do you want me to test?  The two of you 
> have come up with two different versions.
> 
> BTW, the current state of the code is highly suspicious-looking.  
> stop_activity() sets "driver" but never uses it.  Your comment that the 
> driver needs to be notified about a Reset interrupt is certainly 
> correct.

right, that's what needs to be fixed. I removed too much code when
converting to udc_start()/udc_stop().

Here's the diff which needs testing:

diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c
index 03e4104..4a3ef11 100644
--- a/drivers/usb/gadget/net2272.c
+++ b/drivers/usb/gadget/net2272.c
@@ -1492,6 +1492,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver)
 	for (i = 0; i < 4; ++i)
 		net2272_dequeue_all(&dev->ep[i]);
 
+	/* report disconnect; the driver is already quiesced */
+	if (driver) {
+		spin_unlock(&dev->lock);
+		driver->disconnect(&dev->gadget);
+		spin_lock(&dev->lock);
+	}
+
 	net2272_usb_reinit(dev);
 }
 
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 691cc65..d23c1b8 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -1941,6 +1941,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver)
 	for (i = 0; i < 7; i++)
 		nuke (&dev->ep [i]);
 
+	/* report disconnect; the driver is already quiesced */
+	if (driver) {
+		spin_unlock (&dev->lock);
+		driver->disconnect (&dev->gadget);
+		spin_lock (&dev->lock);
+	}
+
 	usb_reinit (dev);
 }
 

-- 
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