diff options
author | Ming Lei <tom.leiming@gmail.com> | 2010-11-01 10:11:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-01 10:11:54 -0400 |
commit | b0786b430c982dffbb44d8030e6b6088671ce745 (patch) | |
tree | 033192c4b031a0b3a800c5e340ddeb7387ecff50 /drivers | |
parent | 6f9b901823aafd14a84ae27f61ff28bafed01260 (diff) |
usbnet: fix usb_autopm_get_interface failure(v1)
Since usbnet already took usb runtime pm, we have to
enable runtime pm for usb interface of usbnet, otherwise
usb_autopm_get_interface may return failure and cause
'ifconfig usb0 up' failed if USB_SUSPEND(RUNTIME_PM) is
enabled.
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Joe Perches <joe@perches.com>
Cc: Oliver Neukum <oliver@neukum.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/usbnet.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index ca7fc9df1ccf..c04d49e31f81 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/usb/usbnet.h> | 45 | #include <linux/usb/usbnet.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/kernel.h> | 47 | #include <linux/kernel.h> |
48 | #include <linux/pm_runtime.h> | ||
48 | 49 | ||
49 | #define DRIVER_VERSION "22-Aug-2005" | 50 | #define DRIVER_VERSION "22-Aug-2005" |
50 | 51 | ||
@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1273 | struct usb_device *xdev; | 1274 | struct usb_device *xdev; |
1274 | int status; | 1275 | int status; |
1275 | const char *name; | 1276 | const char *name; |
1277 | struct usb_driver *driver = to_usb_driver(udev->dev.driver); | ||
1278 | |||
1279 | /* usbnet already took usb runtime pm, so have to enable the feature | ||
1280 | * for usb interface, otherwise usb_autopm_get_interface may return | ||
1281 | * failure if USB_SUSPEND(RUNTIME_PM) is enabled. | ||
1282 | */ | ||
1283 | if (!driver->supports_autosuspend) { | ||
1284 | driver->supports_autosuspend = 1; | ||
1285 | pm_runtime_enable(&udev->dev); | ||
1286 | } | ||
1276 | 1287 | ||
1277 | name = udev->dev.driver->name; | 1288 | name = udev->dev.driver->name; |
1278 | info = (struct driver_info *) prod->driver_info; | 1289 | info = (struct driver_info *) prod->driver_info; |