Commit 5d398779 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: storage: Never reset devices that will morph to an old mode

Some devices must be switched to a new mode to fully use them.
A reset would make them revert to the old mode. Therefore a reset
must not be used for error handling with such devices.
Signed-off-by: default avatarOliver Neukum <oliver@neukum.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d1b5b5c0
...@@ -120,6 +120,7 @@ void usb_detect_quirks(struct usb_device *udev) ...@@ -120,6 +120,7 @@ void usb_detect_quirks(struct usb_device *udev)
* for all devices. It will affect things like hub resets * for all devices. It will affect things like hub resets
* and EMF-related port disables. * and EMF-related port disables.
*/ */
udev->persist_enabled = 1; if (!(udev->quirks & USB_QUIRK_RESET_MORPHS))
udev->persist_enabled = 1;
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
} }
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/usb/quirks.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/scsi_eh.h> #include <scsi/scsi_eh.h>
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
...@@ -1297,6 +1299,10 @@ int usb_stor_port_reset(struct us_data *us) ...@@ -1297,6 +1299,10 @@ int usb_stor_port_reset(struct us_data *us)
{ {
int result; int result;
/*for these devices we must use the class specific method */
if (us->pusb_dev->quirks & USB_QUIRK_RESET_MORPHS)
return -EPERM;
result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf); result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);
if (result < 0) if (result < 0)
US_DEBUGP("unable to lock device for reset: %d\n", result); US_DEBUGP("unable to lock device for reset: %d\n", result);
......
...@@ -19,4 +19,7 @@ ...@@ -19,4 +19,7 @@
/* device can't handle its Configuration or Interface strings */ /* device can't handle its Configuration or Interface strings */
#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
/*device will morph if reset, don't use reset for handling errors */
#define USB_QUIRK_RESET_MORPHS 0x00000010
#endif /* __LINUX_USB_QUIRKS_H */ #endif /* __LINUX_USB_QUIRKS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment