Upstream Commit: 6f39504de55ef69bb8d9d0a645949c5d0407faab
Upstream Kernel Tag: v3.2-rc1-7-g6f39504

During modprobe of gadget driver, pullup is called after udc_start.
In order to make the exit path symmetric when removing a gadget driver,
call pullup before ->udc_stop.

This is needed to avoid issues with PM where udc_stop disables the
module completely (put IP in reset state, cut functional and interface
clocks, and so on), which prevents us from accessing the IP's address
space, thus creating the possibility of an abort exception when we try
to access IP's address space after clocks are off.

This affects anyone using the sysfs interface for device-initiated
connect/disconnect.

Cc: [email protected]
Signed-off-by: Partha Basak <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
---
Tested modprobe g_zero and rmmod g_zero with 4430SDP (musb) to test for any
regression.
 drivers/usb/gadget/udc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 56da49f..24c099f 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -264,8 +264,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
        if (udc_is_newstyle(udc)) {
                udc->driver->disconnect(udc->gadget);
                udc->driver->unbind(udc->gadget);
-               usb_gadget_udc_stop(udc->gadget, udc->driver);
                usb_gadget_disconnect(udc->gadget);
+               usb_gadget_udc_stop(udc->gadget, udc->driver);
        } else {
                usb_gadget_stop(udc->gadget, udc->driver);
        }
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to