]>
Commit | Line | Data |
---|---|---|
fa6bf050 GKH |
1 | From c5a48592d874ddef8c7880311581eccf0eb30c3b Mon Sep 17 00:00:00 2001 |
2 | From: Jim Wylder <jwylder1@motorola.com> | |
3 | Date: Tue, 6 Sep 2011 21:07:20 -0500 | |
4 | Subject: USB: for usb_autopm_get_interface_async -EINPROGRESS is not an error | |
5 | ||
6 | From: Jim Wylder <jwylder1@motorola.com> | |
7 | ||
8 | commit c5a48592d874ddef8c7880311581eccf0eb30c3b upstream. | |
9 | ||
10 | A return value of -EINPROGRESS from pm_runtime_get indicates that | |
11 | the device is already resuming due to a previous call. Internally, | |
12 | usb_autopm_get_interface_async doesn't treat this as an error and | |
13 | increments the usage count, but passes the error status along | |
14 | to the caller. The logical assumption of the caller is that | |
15 | any negative return value reflects the device not resuming | |
16 | and the pm_usage_cnt not being incremented. Since the usage count | |
17 | is being incremented and the device is resuming, return success (0) | |
18 | instead. | |
19 | ||
20 | Signed-off-by: James Wylder <james.wylder@motorola.com> | |
21 | Acked-by: Alan Stern <stern@rowland.harvard.edu> | |
22 | Signed-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 | } |