usb: mdm_bridge: Decrement PM-usage counter in completion handler
mdm bridge control driver increments the PM usage counter before
submitting the tx URB, but counter was never decremented after that,
which prevents the device from entering suspend.
Change-Id: I3bf9cf0de876a53c21cc0edd8fdeeb0fe20a4905
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
diff --git a/drivers/usb/misc/mdm_ctrl_bridge.c b/drivers/usb/misc/mdm_ctrl_bridge.c
index 11d388c..584503a 100644
--- a/drivers/usb/misc/mdm_ctrl_bridge.c
+++ b/drivers/usb/misc/mdm_ctrl_bridge.c
@@ -333,6 +333,7 @@
static void ctrl_write_callback(struct urb *urb)
{
+ struct ctrl_bridge *dev = urb->context;
if (urb->status) {
pr_debug("Write status/size %d/%d\n",
@@ -342,6 +343,7 @@
kfree(urb->transfer_buffer);
kfree(urb->setup_packet);
usb_free_urb(urb);
+ usb_autopm_put_interface_async(dev->intf);
}
int ctrl_bridge_write(unsigned int id, char *data, size_t size)
@@ -406,7 +408,7 @@
usb_sndctrlpipe(udev, 0),
(unsigned char *)out_ctlreq,
(void *)data, size,
- ctrl_write_callback, NULL);
+ ctrl_write_callback, dev);
result = usb_autopm_get_interface_async(dev->intf);
if (result < 0) {