Re: [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]

 



于 2012/7/24 22:21, Alan Stern 写道:
On Tue, 24 Jul 2012, Lan Tianyu wrote:
@@ -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)

Please do me a favor: Rename the "config" variable to something else,
such as "morphs" or "val".  In USB, the word "config" already has a
separate meaning.
Ok. I will do it. A seperate patch?

  		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;

This line doesn't seem right.  What if the user _wants_ persist_enabled
to be 0?
This seems attribute avoid_reset_quirk is conflicted with persist.
From my opinion, avoid_reset_quirk may have high priority.
So we can add a USB_QUIRK_RESET_MORPHS check in the attribute persist
store callback, if USB_QUIRK_RESET_MORPHS flag had been set, persist couldn't be changed and remain 0 since this patch set persist to 0 when
USB_QUIRK_RESET_MORPHS flag is set. Do this make sense?



+	}
  	usb_unlock_device(udev);
  	return count;
  }

Alan Stern

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


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