Skip to content

Commit

Permalink
USB: for usb_autopm_get_interface_async -EINPROGRESS is not an error
Browse files Browse the repository at this point in the history
A return value of -EINPROGRESS from pm_runtime_get indicates that
the device is already resuming due to a previous call.  Internally,
usb_autopm_get_interface_async doesn't treat this as an error and
increments the usage count, but passes the error status along
to the caller.  The logical assumption of the caller is that
any negative return value reflects the device not resuming
and the pm_usage_cnt not being incremented.  Since the usage count
is being incremented and the device is resuming, return success (0)
instead.

Signed-off-by: James Wylder <james.wylder@motorola.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jim Wylder authored and Greg Kroah-Hartman committed Sep 9, 2011
1 parent e16da02 commit c5a4859
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ int usb_autopm_get_interface_async(struct usb_interface *intf)
dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n",
__func__, atomic_read(&intf->dev.power.usage_count),
status);
if (status > 0)
if (status > 0 || status == -EINPROGRESS)
status = 0;
return status;
}
Expand Down

0 comments on commit c5a4859

Please sign in to comment.