diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/sysfs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 5f3908f6e2dc..b1725abf6c7b 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -191,6 +191,36 @@ show_quirks(struct device *dev, struct device_attribute *attr, char *buf) | |||
191 | static DEVICE_ATTR(quirks, S_IRUGO, show_quirks, NULL); | 191 | static DEVICE_ATTR(quirks, S_IRUGO, show_quirks, NULL); |
192 | 192 | ||
193 | static ssize_t | 193 | static ssize_t |
194 | show_avoid_reset_quirk(struct device *dev, struct device_attribute *attr, char *buf) | ||
195 | { | ||
196 | struct usb_device *udev; | ||
197 | |||
198 | udev = to_usb_device(dev); | ||
199 | return sprintf(buf, "%d\n", !!(udev->quirks & USB_QUIRK_RESET_MORPHS)); | ||
200 | } | ||
201 | |||
202 | static ssize_t | ||
203 | set_avoid_reset_quirk(struct device *dev, struct device_attribute *attr, | ||
204 | const char *buf, size_t count) | ||
205 | { | ||
206 | struct usb_device *udev = to_usb_device(dev); | ||
207 | int config; | ||
208 | |||
209 | if (sscanf(buf, "%d", &config) != 1 || config < 0 || config > 1) | ||
210 | return -EINVAL; | ||
211 | usb_lock_device(udev); | ||
212 | if (config) | ||
213 | udev->quirks |= USB_QUIRK_RESET_MORPHS; | ||
214 | else | ||
215 | udev->quirks &= ~USB_QUIRK_RESET_MORPHS; | ||
216 | usb_unlock_device(udev); | ||
217 | return count; | ||
218 | } | ||
219 | |||
220 | static DEVICE_ATTR(avoid_reset_quirk, S_IRUGO | S_IWUSR, | ||
221 | show_avoid_reset_quirk, set_avoid_reset_quirk); | ||
222 | |||
223 | static ssize_t | ||
194 | show_urbnum(struct device *dev, struct device_attribute *attr, char *buf) | 224 | show_urbnum(struct device *dev, struct device_attribute *attr, char *buf) |
195 | { | 225 | { |
196 | struct usb_device *udev; | 226 | struct usb_device *udev; |
@@ -558,6 +588,7 @@ static struct attribute *dev_attrs[] = { | |||
558 | &dev_attr_version.attr, | 588 | &dev_attr_version.attr, |
559 | &dev_attr_maxchild.attr, | 589 | &dev_attr_maxchild.attr, |
560 | &dev_attr_quirks.attr, | 590 | &dev_attr_quirks.attr, |
591 | &dev_attr_avoid_reset_quirk.attr, | ||
561 | &dev_attr_authorized.attr, | 592 | &dev_attr_authorized.attr, |
562 | &dev_attr_remove.attr, | 593 | &dev_attr_remove.attr, |
563 | NULL, | 594 | NULL, |