usb: gadget: pxa27x: fix suspend callback
Subsystems (3)
PATCH 1/1 usb: gadget: pxa27x: fix suspend callback
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 callinggadget_driver->disconnect().
--- drivers/usb/gadget/udc/pxa27x_udc.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/pxa27x_udc.c +1 -0
@@ -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 ; }
Signature · 1 line
2.6.3
Robert Jarzmik
maintainerQuoted 10 lines · Felipe Balbi
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.
drivers/usb/gadget/udc/pxa27x_udc.c static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state) · line 2538
Quoted 5 lines
drivers/usb/gadget/udc/pxa27x_udc.c +1
-0@@ -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.
Signature · 1 line
Robert
Hi,
Quoted 12 lines · Robert Jarzmik
Quoted 10 lines · Felipe Balbi
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().
Quoted 8 lines
Thanks for doing this for me.
drivers/usb/gadget/udc/pxa27x_udc.c static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state) · line 2538
Quoted 5 lines
drivers/usb/gadget/udc/pxa27x_udc.c +1
-0@@ -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.
Signature · 1 line
balbi
PATCH 1/1 usb: gadget: pxa27x: fix suspend callback
In reply to Robert Jarzmikpxa27x 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 callinggadget_driver->disconnect().
--- drivers/usb/gadget/udc/pxa27x_udc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/udc/pxa27x_udc.c +3 -0
@@ -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 ; }
Signature · 1 line
2.6.3
Quoted 8 lines · Felipe Balbi
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().
Quoted 5 lines
Fix this problem by calling
gadget_driver->disconnect().Cc <[email protected]> # v3.10+Signed-off-by Felipe Balbi <[email protected]>
Cheers.
--
Robert