Skip to contentSkip to conversation

r8152: fix setting RTL8152_UNPLUG

PATCH Applied Hayes Wang 2 participants 2 messages Sep 30, 2014

Subsystems (3)
lore
Share & tools
lore

Hayes Wang

author
#0 lore raw

PATCH 1/1 r8152: fix setting RTL8152_UNPLUG

The flag of RTL8152_UNPLUG should only be set when the device is unplugged, not each time the rtl8152_disconnect() is called. Otherwise, the device wouldn't be stopped normally.

---
 drivers/net/usb/r8152.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +5 -1
index e039442..f68a4e6 100644
@@ -3576,7 +3576,11 @@ static void rtl8152_disconnect(struct usb_interface *intf)
 
 	usb_set_intfdata(intf, NULL);
 	if (tp) {
-		set_bit(RTL8152_UNPLUG, &tp->flags);
+		struct usb_device *udev = tp->udev;
+
+		if (udev->state == USB_STATE_NOTATTACHED)
+			set_bit(RTL8152_UNPLUG, &tp->flags);
+
 		tasklet_kill(&tp->tl);
 		unregister_netdev(tp->netdev);
 		tp->rtl_ops.unload(tp);
Signature · 1 line
1.9.3
maintainer Applied
#1 lore raw

From: Hayes Wang <[email protected]>
Date: Tue, 30 Sep 2014 16:48:01 +0800

Quoted 5 lines

The flag of RTL8152_UNPLUG should only be set when the device is unplugged, not each time the rtl8152_disconnect() is called. Otherwise, the device wouldn't be stopped normally.

Applied, thanks.