[RFC][PATCH] USB: fix usb_remove_store

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ming Lei <tom.leiming@xxxxxxxxx>

For root-hub devices, we don't support the 'remove' action,
but deconfiguration may cause root-hub to stop work even
usb_remove_device returns failure.

Considered it is very similar to remove a usb device by
usb_remove_device only, compared with physical disconnection processing.

There are no races conditions found if only usb_remove_device is
called to do 'remove' action without deconfiguration, so remove
the deconfiguration to fix it.

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
---
 drivers/usb/core/sysfs.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 06863be..5a2add3 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -568,12 +568,9 @@ static ssize_t usb_remove_store(struct device *dev,
 	int rc = 0;
 
 	usb_lock_device(udev);
-	if (udev->state != USB_STATE_NOTATTACHED) {
-
-		/* To avoid races, first unconfigure and then remove */
-		usb_set_configuration(udev, -1);
+	if (udev->state != USB_STATE_NOTATTACHED)
 		rc = usb_remove_device(udev);
-	}
+
 	if (rc == 0)
 		rc = count;
 	usb_unlock_device(udev);
-- 
1.6.2.5

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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux