Thread (58 messages) 58 messages, 5 authors, 2015-08-20

Re: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism

From: John Youn <hidden>
Date: 2015-08-20 20:07:46
Also in: linux-arm-kernel, linux-omap, lkml

On 8/20/2015 10:45 AM, Felipe Balbi wrote:=0A=
Hi,=0A=
=0A=
On Thu, Aug 20, 2015 at 07:16:48PM +0200, Robert Baldyga wrote:=0A=
quoted
On 08/20/2015 06:48 PM, Felipe Balbi wrote:=0A=
quoted
On Thu, Aug 20, 2015 at 06:28:14PM +0200, Robert Baldyga wrote:=0A=
quoted
Hi Felipe,=0A=
=0A=
On 08/20/2015 05:35 PM, Felipe Balbi wrote:=0A=
[...]=0A=
quoted
just letting you know that this regresses all gadget drivers making t=
hem=0A=
quoted
quoted
quoted
quoted
try to disable previously disabled endpoints and enable previously=0A=
enabled endpoints.=0A=
=0A=
I have a possible fix (see below) but then it shows a problem on the=
=0A=
quoted
quoted
quoted
quoted
host side when using with g_zero (see further below):=0A=
=0A=
commit 3b8932100aacb6cfbffe288ca93025d8b8430c00=0A=
Author: Felipe Balbi [off-list ref]=0A=
Date:   Wed Aug 19 18:05:27 2015 -0500=0A=
=0A=
    usb: gadget: fix ep->claimed lifetime=0A=
=0A=
    In order to fix a regression introduced by commit=0A=
    cc476b42a39d ("usb: gadget: encapsulate endpoint=0A=
    claiming mechanism") we have to introduce a simple=0A=
    helper to check if a particular is enabled or not.=0A=
=0A=
    After that, we need to move ep->claimed lifetime to=0A=
    usb_ep_enable() and usb_ep_disable() since those=0A=
    are the only functions which actually enable and=0A=
    disable endpoints.=0A=
=0A=
    A follow-up patch will come to drop all driver_data=0A=
    checks from function drivers, since those are, now,=0A=
    pointless.=0A=
=0A=
    Fixes: cc476b42a39d ("usb: gadget: encapsulate endpoint=0A=
    	claiming mechanism")=0A=
    Cc: Robert Baldyga [off-list ref]=0A=
    Signed-off-by: Felipe Balbi [off-list ref]=0A=
=0A=
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epa=
utoconf.c=0A=
quoted
quoted
quoted
quoted
index 978435a51038..ad45070cd76f 100644=0A=
--- a/drivers/usb/gadget/epautoconf.c=0A=
+++ b/drivers/usb/gadget/epautoconf.c=0A=
@@ -126,7 +126,6 @@ found_ep:=0A=
 	ep->address =3D desc->bEndpointAddress;=0A=
 	ep->desc =3D NULL;=0A=
 	ep->comp_desc =3D NULL;=0A=
-	ep->claimed =3D true;=0A=
=0A=
Removing this line causes autoconfig can return the same endpoint many=
=0A=
quoted
quoted
quoted
times. This probably causes problems with g_zero.=0A=
=0A=
I will try to fix it ASAP.=0A=
=0A=
I was considering the same thing, but the lifetime of ->claimed doesn't=
=0A=
quoted
quoted
look correct to me either way. Note that once the flag is enabled, it=
=0A=
quoted
quoted
won't get disabled by most gadget drivers.=0A=
=0A=
And it should not be. This flag is indicator, that endpoint is used by s=
ome=0A=
quoted
function. It should be set once by usb_ep_autoconfig() and cleared by=0A=
usb_ep_autoconfig_reset().=0A=
=0A=
And the 'claimed' flag should be used for the ep autoconfig=0A=
mechanism alone. We may want to reset it during the autoconfig=0A=
phase for multiple configs and alt-interfaces. So there should be=0A=
separate 'claimed' and 'enabled' flags.=0A=
=0A=
=0A=
=0A=
have you considered switching interfaces and/or alternate settings ?=0A=
=0A=
We ran into similar issues before with this very scenario. Handling=0A=
of set_config(0 or N), in both addressed and configured states, and=0A=
set_interface requests.=0A=
=0A=
=0A=
John=0A=
=0A=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help