netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbnet: fix usb_autopm_get_interface failure(v1)
@ 2010-11-01 14:05 tom.leiming
  2010-11-01 14:13 ` David Miller
  2010-11-01 15:04 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: tom.leiming @ 2010-11-01 14:05 UTC (permalink / raw)
  To: netdev, oliver, davem
  Cc: Ming Lei, David Brownell, Greg Kroah-Hartman, Ben Hutchings,
	Joe Perches, Andy Shevchenko, stable

From: Ming Lei <tom.leiming@gmail.com>

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>
---
v1: include header file

---
 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 ca7fc9d..06b1dee 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -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;
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbnet: fix usb_autopm_get_interface failure(v1)
  2010-11-01 14:05 [PATCH] usbnet: fix usb_autopm_get_interface failure(v1) tom.leiming
@ 2010-11-01 14:13 ` David Miller
  2010-11-01 15:04 ` Andy Shevchenko
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-11-01 14:13 UTC (permalink / raw)
  To: tom.leiming
  Cc: netdev, oliver, dbrownell, gregkh, ben, joe, andy.shevchenko,
	stable

From: tom.leiming@gmail.com
Date: Mon,  1 Nov 2010 22:05:49 +0800

> From: Ming Lei <tom.leiming@gmail.com>
> 
> 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>
> ---
> v1: include header file

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbnet: fix usb_autopm_get_interface failure(v1)
  2010-11-01 14:05 [PATCH] usbnet: fix usb_autopm_get_interface failure(v1) tom.leiming
  2010-11-01 14:13 ` David Miller
@ 2010-11-01 15:04 ` Andy Shevchenko
  2010-11-01 15:08   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2010-11-01 15:04 UTC (permalink / raw)
  To: tom.leiming
  Cc: netdev, oliver, davem, David Brownell, Greg Kroah-Hartman,
	Ben Hutchings, Joe Perches, stable

On Mon, Nov 1, 2010 at 4:05 PM,  <tom.leiming@gmail.com> wrote:
> From: Ming Lei <tom.leiming@gmail.com>
>
> 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>
> ---
> v1: include header file
>
> ---
>  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 ca7fc9d..06b1dee 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -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.
> +       * */
Just minor: multiline comments doesn't follow the required style.

> +       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
>
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbnet: fix usb_autopm_get_interface failure(v1)
  2010-11-01 15:04 ` Andy Shevchenko
@ 2010-11-01 15:08   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-11-01 15:08 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: tom.leiming, netdev, oliver, dbrownell, gregkh, ben, joe, stable

From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Mon, 1 Nov 2010 17:04:35 +0200

>> +       /*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.

There were also spaces before tabs at the beginning of each
line.

I fixed all of this up when applying the patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-01 15:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-01 14:05 [PATCH] usbnet: fix usb_autopm_get_interface failure(v1) tom.leiming
2010-11-01 14:13 ` David Miller
2010-11-01 15:04 ` Andy Shevchenko
2010-11-01 15:08   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).