]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.1.1/usb-for-usb_autopm_get_interface_async-einprogress-is-not-an-error.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.1.1 / usb-for-usb_autopm_get_interface_async-einprogress-is-not-an-error.patch
CommitLineData
fa6bf050
GKH
1From c5a48592d874ddef8c7880311581eccf0eb30c3b Mon Sep 17 00:00:00 2001
2From: Jim Wylder <jwylder1@motorola.com>
3Date: Tue, 6 Sep 2011 21:07:20 -0500
4Subject: USB: for usb_autopm_get_interface_async -EINPROGRESS is not an error
5
6From: Jim Wylder <jwylder1@motorola.com>
7
8commit c5a48592d874ddef8c7880311581eccf0eb30c3b upstream.
9
10A return value of -EINPROGRESS from pm_runtime_get indicates that
11the device is already resuming due to a previous call. Internally,
12usb_autopm_get_interface_async doesn't treat this as an error and
13increments the usage count, but passes the error status along
14to the caller. The logical assumption of the caller is that
15any negative return value reflects the device not resuming
16and the pm_usage_cnt not being incremented. Since the usage count
17is being incremented and the device is resuming, return success (0)
18instead.
19
20Signed-off-by: James Wylder <james.wylder@motorola.com>
21Acked-by: Alan Stern <stern@rowland.harvard.edu>
22Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23
24---
25 drivers/usb/core/driver.c | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28--- a/drivers/usb/core/driver.c
29+++ b/drivers/usb/core/driver.c
30@@ -1583,7 +1583,7 @@ int usb_autopm_get_interface_async(struc
31 dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n",
32 __func__, atomic_read(&intf->dev.power.usage_count),
33 status);
34- if (status > 0)
35+ if (status > 0 || status == -EINPROGRESS)
36 status = 0;
37 return status;
38 }