usbnet: fix usb_autopm_get_interface failure(v1)
PATCH 1/1 usbnet: fix usb_autopm_get_interface failure(v1)
From: Ming Lei <[email protected]>
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.
---
v1: include header file
--- drivers/net/usb/usbnet.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/net/usb/usbnet.c +11 -0
@@ -45,6 +45,7 @@#include <linux/usb/usbnet.h> #include <linux/slab.h> #include <linux/kernel.h> +#include <linux/pm_runtime.h> #define DRIVER_VERSION "22-Aug-2005"
@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)struct usb_device *xdev;int status;const char *name; +struct usb_driver *driver =to_usb_driver (udev->dev.driver); + +/*usbnet already took usb runtime pm, so have to enable the feature +* for usb interface, otherwise usb_autopm_get_interface may return +* failure if USB_SUSPEND(RUNTIME_PM) is enabled. +* */ +if (!driver->supports_autosuspend) { + driver->supports_autosuspend =1 ; +pm_runtime_enable (&udev->dev); + } name = udev->dev.driver->name; info = (struct driver_info *) prod->driver_info;
Signature · 1 line
1.7.3
From: [email protected]
Date: Mon, 1 Nov 2010 22:05:49 +0800
Quoted 17 lines
From: Ming Lei <[email protected]>
Since usbnet already took usb runtime pm, we have to enable runtime pm for usb interface of usbnet, otherwise
usb_autopm_get_interfacemay return failure and cause 'ifconfig usb0 up' failed ifUSB_SUSPEND(RUNTIME_PM)is enabled.Cc David Brownell <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "David S. Miller" <[email protected]>Cc Ben Hutchings <[email protected]>Cc Joe Perches <[email protected]>Cc Oliver Neukum <[email protected]>Cc Andy Shevchenko <[email protected]>Signed-off-by Ming Lei <[email protected]>
Quoted 2 lines
---
v1: include header file
Applied, thanks.
Quoted 37 lines · On Mon, Nov 1, 2010 at 4:05 PM, <[email protected]> wrote:
From: Ming Lei <[email protected]>
Since usbnet already took usb runtime pm, we have to enable runtime pm for usb interface of usbnet, otherwise
usb_autopm_get_interfacemay return failure and cause 'ifconfig usb0 up' failed ifUSB_SUSPEND(RUNTIME_PM)is enabled.Cc David Brownell <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "David S. Miller" <[email protected]>Cc Ben Hutchings <[email protected]>Cc Joe Perches <[email protected]>Cc Oliver Neukum <[email protected]>Cc Andy Shevchenko <[email protected]>Signed-off-by Ming Lei <[email protected]>---
v1: include header file---
drivers/net/usb/usbnet.c | 11 +++++++++++1 files changed, 11 insertions(+), 0 deletions(-)drivers/net/usb/usbnet.c +1
-0@@ -45,6 +45,7 @@ #include <linux/usb/usbnet.h> #include <linux/slab.h> #include <linux/kernel.h> +#include <linux/pm_runtime.h> #define DRIVER_VERSION "22-Aug-2005"
drivers/net/usb/usbnet.c usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) · line 1282
Quoted 9 lines
drivers/net/usb/usbnet.c +6
-0@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) struct usb_device *xdev; int status; const char *name; + struct usb_driver *driver = to_usb_driver(udev->dev.driver); + + /*usbnet already took usb runtime pm, so have to enable the feature +* for usb interface, otherwise usb_autopm_get_interface may return +* failure if USB_SUSPEND(RUNTIME_PM) is enabled. +* */
Just minor: multiline comments doesn't follow the required style.
Quoted 11 lines
drivers/net/usb/usbnet.c +4
-1+ if (!driver->supports_autosuspend) { + driver->supports_autosuspend = 1; + pm_runtime_enable(&udev->dev); + } name = udev->dev.driver->name; info = (struct driver_info *) prod->driver_info; --1.7.3
Signature · 2 lines
With Best Regards, Andy Shevchenko
David Miller
maintainerFrom: Andy Shevchenko <[email protected]>
Date: Mon, 1 Nov 2010 17:04:35 +0200
Quoted 5 lines
Quoted 4 lines
+ /*usbnet already took usb runtime pm, so have to enable the feature
+ * for usb interface, otherwiseusb_autopm_get_interfacemay return
+ * failure ifUSB_SUSPEND(RUNTIME_PM)is enabled.
+ * */Just minor: multiline comments doesn't follow the required style.
There were also spaces before tabs at the beginning of each line.
I fixed all of this up when applying the patch.