[RFC PATCH] usb: Change persist_enabled when attribute avoid_reset_quirk is changed

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

 



The quirk USB_QUIRK_RESET_MORPHS means the device can't be reset
and reset-resume. So persist_enabled also should be set simultaneously
with USB_QUIRK_RESET_MORPHS flag. But Currently in the attribute
avoid_reset_quirk store callback just set USB_QUIRK_RESET_MORPHS.
The persist_enabled will only be updated in the usb_detect_quirks()
due to USB_QUIRK_RESET_MORPHS. usb_detect_quirks() is only called when
a device is enumerated. So after a device enumerated, persist_enabled will
not be changed when attribute avoid_reset_quirk is changed. This patch
is to change persist_enabled when atrribute avoid_reset_quirk is changed.

Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
---
 drivers/usb/core/sysfs.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 682e825..12b4bf9 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -209,10 +209,13 @@ set_avoid_reset_quirk(struct device *dev, struct device_attribute *attr,
 	if (sscanf(buf, "%d", &config) != 1 || config < 0 || config > 1)
 		return -EINVAL;
 	usb_lock_device(udev);
-	if (config)
+	if (config) {
 		udev->quirks |= USB_QUIRK_RESET_MORPHS;
-	else
+		udev->persist_enabled = 0;
+	} else {
 		udev->quirks &= ~USB_QUIRK_RESET_MORPHS;
+		udev->persist_enabled = 1;
+	}
 	usb_unlock_device(udev);
 	return count;
 }
-- 
1.7.6.rc2.8.g28eb

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