From mboxrd@z Thu Jan 1 00:00:00 1970 From: r.baldyga@hackerion.com (Robert Baldyga) Date: Thu, 20 Aug 2015 18:28:14 +0200 Subject: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism In-Reply-To: <20150820153553.GD1639@saruman.tx.rr.com> References: <1438351258-31578-1-git-send-email-r.baldyga@samsung.com> <1438351258-31578-2-git-send-email-r.baldyga@samsung.com> <20150820153553.GD1639@saruman.tx.rr.com> Message-ID: <55D6001E.3000504@hackerion.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Felipe, On 08/20/2015 05:35 PM, Felipe Balbi wrote: [...] > just letting you know that this regresses all gadget drivers making them > try to disable previously disabled endpoints and enable previously > enabled endpoints. > > I have a possible fix (see below) but then it shows a problem on the > host side when using with g_zero (see further below): > > commit 3b8932100aacb6cfbffe288ca93025d8b8430c00 > Author: Felipe Balbi > Date: Wed Aug 19 18:05:27 2015 -0500 > > usb: gadget: fix ep->claimed lifetime > > In order to fix a regression introduced by commit > cc476b42a39d ("usb: gadget: encapsulate endpoint > claiming mechanism") we have to introduce a simple > helper to check if a particular is enabled or not. > > After that, we need to move ep->claimed lifetime to > usb_ep_enable() and usb_ep_disable() since those > are the only functions which actually enable and > disable endpoints. > > A follow-up patch will come to drop all driver_data > checks from function drivers, since those are, now, > pointless. > > Fixes: cc476b42a39d ("usb: gadget: encapsulate endpoint > claiming mechanism") > Cc: Robert Baldyga > Signed-off-by: Felipe Balbi > > diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c > index 978435a51038..ad45070cd76f 100644 > --- a/drivers/usb/gadget/epautoconf.c > +++ b/drivers/usb/gadget/epautoconf.c > @@ -126,7 +126,6 @@ found_ep: > ep->address = desc->bEndpointAddress; > ep->desc = NULL; > ep->comp_desc = NULL; > - ep->claimed = true; Removing this line causes autoconfig can return the same endpoint many times. This probably causes problems with g_zero. I will try to fix it ASAP. Thanks, Robert