Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: pxa27x: fix suspend callback
@ 2015-11-19 15:01 Felipe Balbi
  2015-11-19 19:33 ` Robert Jarzmik
  0 siblings, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2015-11-19 15:01 UTC (permalink / raw)
  To: Linux USB Mailing List
  Cc: Robert Jarzmik, Robert Baldyga, Felipe Balbi, # v3 . 10+

pxa27x disconnects pullups on suspend but doesn't
notify the gadget driver about it, so gadget driver
can't disable the endpoints it was using.

This causes problems on resume because gadget core
will think endpoints are still enabled and just
ignore the following usb_ep_enable().

Fix this problem by calling
gadget_driver->disconnect().

Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 670ac0b12f00..a08ae19ca410 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -2535,6 +2535,7 @@ static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state)
 	udc_disable(udc);
 	udc->pullup_resume = udc->pullup_on;
 	dplus_pullup(udc, 0);
+	udc->driver->disconnect(&udc->gadget);
 
 	return 0;
 }
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: pxa27x: fix suspend callback
  2015-11-19 15:01 [PATCH] usb: gadget: pxa27x: fix suspend callback Felipe Balbi
@ 2015-11-19 19:33 ` Robert Jarzmik
  2015-11-19 19:48   ` Felipe Balbi
  2015-11-19 19:51   ` Felipe Balbi
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Jarzmik @ 2015-11-19 19:33 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux USB Mailing List, Robert Baldyga, # v3 . 10+

Felipe Balbi <balbi@ti.com> writes:

> pxa27x disconnects pullups on suspend but doesn't
> notify the gadget driver about it, so gadget driver
> can't disable the endpoints it was using.
>
> This causes problems on resume because gadget core
> will think endpoints are still enabled and just
> ignore the following usb_ep_enable().
>
> Fix this problem by calling
> gadget_driver->disconnect().
Thanks for doing this for me.
> @@ -2535,6 +2535,7 @@ static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state)
>  	udc_disable(udc);
>  	udc->pullup_resume = udc->pullup_on;
>  	dplus_pullup(udc, 0);
> +	udc->driver->disconnect(&udc->gadget);
If no driver is bound, this will segfault, right ?
Shouldn't an "if (udc->driver)" protect this line ?

Cheers.

-- 
Robert

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: pxa27x: fix suspend callback
  2015-11-19 19:33 ` Robert Jarzmik
@ 2015-11-19 19:48   ` Felipe Balbi
  2015-11-19 19:51   ` Felipe Balbi
  1 sibling, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2015-11-19 19:48 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: Linux USB Mailing List, Robert Baldyga, # v3 . 10+

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]


Hi,

Robert Jarzmik <robert.jarzmik@free.fr> writes:
> Felipe Balbi <balbi@ti.com> writes:
>
>> pxa27x disconnects pullups on suspend but doesn't
>> notify the gadget driver about it, so gadget driver
>> can't disable the endpoints it was using.
>>
>> This causes problems on resume because gadget core
>> will think endpoints are still enabled and just
>> ignore the following usb_ep_enable().
>>
>> Fix this problem by calling
>> gadget_driver->disconnect().
> Thanks for doing this for me.
>> @@ -2535,6 +2535,7 @@ static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state)
>>  	udc_disable(udc);
>>  	udc->pullup_resume = udc->pullup_on;
>>  	dplus_pullup(udc, 0);
>> +	udc->driver->disconnect(&udc->gadget);
> If no driver is bound, this will segfault, right ?
> Shouldn't an "if (udc->driver)" protect this line ?

good catch. v2 coming shortly.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] usb: gadget: pxa27x: fix suspend callback
  2015-11-19 19:33 ` Robert Jarzmik
  2015-11-19 19:48   ` Felipe Balbi
@ 2015-11-19 19:51   ` Felipe Balbi
  2015-11-19 20:44     ` Robert Jarzmik
  1 sibling, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2015-11-19 19:51 UTC (permalink / raw)
  To: Linux USB Mailing List; +Cc: robert.jarzmik, Felipe Balbi, # v3 . 10+

pxa27x disconnects pullups on suspend but doesn't
notify the gadget driver about it, so gadget driver
can't disable the endpoints it was using.

This causes problems on resume because gadget core
will think endpoints are still enabled and just
ignore the following usb_ep_enable().

Fix this problem by calling
gadget_driver->disconnect().

Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 670ac0b12f00..001a3b74a993 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -2536,6 +2536,9 @@ static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state)
 	udc->pullup_resume = udc->pullup_on;
 	dplus_pullup(udc, 0);
 
+	if (udc->driver)
+		udc->driver->disconnect(&udc->gadget);
+
 	return 0;
 }
 
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: pxa27x: fix suspend callback
  2015-11-19 19:51   ` Felipe Balbi
@ 2015-11-19 20:44     ` Robert Jarzmik
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Jarzmik @ 2015-11-19 20:44 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux USB Mailing List, # v3 . 10+

Felipe Balbi <balbi@ti.com> writes:

> pxa27x disconnects pullups on suspend but doesn't
> notify the gadget driver about it, so gadget driver
> can't disable the endpoints it was using.
>
> This causes problems on resume because gadget core
> will think endpoints are still enabled and just
> ignore the following usb_ep_enable().
>
> Fix this problem by calling
> gadget_driver->disconnect().
>
> Cc: <stable@vger.kernel.org> # v3.10+
> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>

Cheers.

--
Robert

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-19 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 15:01 [PATCH] usb: gadget: pxa27x: fix suspend callback Felipe Balbi
2015-11-19 19:33 ` Robert Jarzmik
2015-11-19 19:48   ` Felipe Balbi
2015-11-19 19:51   ` Felipe Balbi
2015-11-19 20:44     ` Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox