Skip to contentSkip to conversation

usbnet: runtime pm: fix usb_autopm_get_interface failure

PATCH Applied [email protected] 2 participants 3 messages Oct 27, 2010 – Nov 1, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usbnet: runtime pm: fix usb_autopm_get_interface failure

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.

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]>
---
 drivers/net/usb/usbnet.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/usb/usbnet.c +10 -0
index ca7fc9d..765308f 100644
@@ -1273,6 +1273,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
maintainer Applied
#1 lore raw

From: [email protected]
Date: Wed, 27 Oct 2010 22:45:03 +0800

Quoted 8 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_interface may return failure and cause 'ifconfig usb0 up' failed if USB_SUSPEND(RUNTIME_PM) is enabled.

Quoted 9 lines
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]>

Applied, thanks.

maintainer
#2 lore raw

From: David Miller <[email protected]>
Date: Mon, 01 Nov 2010 06:40:52 -0700 (PDT)

Quoted 1 line

Applied, thanks.

Actually, I had to revert, this doesn't compile when CONFIG_PM is disabled:

drivers/net/usb/usbnet.c: In function 'usbnet_probe':
drivers/net/usb/usbnet.c:1284:3: error: implicit declaration of function 'pm_runtime_enable'