netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbnet: prevent device rpm suspend in usbnet_probe function
@ 2016-11-04  9:57 Kai-Heng Feng
  2016-11-04 13:26 ` Alan Stern
  2016-11-07 11:02 ` Oliver Neukum
  0 siblings, 2 replies; 18+ messages in thread
From: Kai-Heng Feng @ 2016-11-04  9:57 UTC (permalink / raw)
  To: oneukum-IBi9RG/b67k
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kai-Heng Feng

Sometimes cdc_mbim failed to probe if runtime pm is enabled:
[    9.305626] cdc_mbim: probe of 2-2:1.12 failed with error -22

This can be solved by increase its pm usage counter.

Signed-off-by: Kai-Heng Feng <kai.heng.feng-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/usbnet.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index d5071e3..f77b4bf 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1674,12 +1674,15 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
 	net->ethtool_ops = &usbnet_ethtool_ops;
 
+	if (usb_autopm_get_interface(dev->intf) < 0)
+		goto out1;
+
 	// allow device-specific bind/init procedures
 	// NOTE net->name still not usable ...
 	if (info->bind) {
 		status = info->bind (dev, udev);
 		if (status < 0)
-			goto out1;
+			goto out2;
 
 		// heuristic:  "usb%d" for links we know are two-host,
 		// else "eth%d" when there's reasonable doubt.  userspace
@@ -1772,6 +1775,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 out3:
 	if (info->unbind)
 		info->unbind (dev, udev);
+out2:
+	usb_autopm_put_interface(dev->intf);
 out1:
 	/* subdrivers must undo all they did in bind() if they
 	 * fail it, but we may fail later and a deferred kevent
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-11-16 10:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-04  9:57 [PATCH] usbnet: prevent device rpm suspend in usbnet_probe function Kai-Heng Feng
2016-11-04 13:26 ` Alan Stern
2016-11-07 10:32   ` Oliver Neukum
2016-11-07 11:02 ` Oliver Neukum
2016-11-08  7:46   ` Kai-Heng Feng
2016-11-08 15:25     ` Alan Stern
2016-11-08 16:49       ` Bjørn Mork
2016-11-08 18:44         ` Alan Stern
2016-11-09 11:58           ` Oliver Neukum
2016-11-09 12:32             ` Bjørn Mork
2016-11-10  4:06               ` Kai-Heng Feng
2016-11-10 11:09                 ` Bjørn Mork
2016-11-10 11:22                   ` Oliver Neukum
2016-11-11 14:44                     ` Mathias Nyman
     [not found]                       ` <5825D962.9090807-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-11-14  7:34                         ` Kai-Heng Feng
2016-11-16 10:29                           ` Kai-Heng Feng
2016-11-10 15:36                 ` Alan Stern
2016-11-10 20:38                   ` Bjørn Mork

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).