diff options
Diffstat (limited to 'drivers/usb/core/sysfs.c')
| -rw-r--r-- | drivers/usb/core/sysfs.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 4ab50009291d..740cb4c668df 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | /* Active configuration fields */ | 25 | /* Active configuration fields */ |
| 26 | #define usb_actconfig_show(field, multiplier, format_string) \ | 26 | #define usb_actconfig_show(field, multiplier, format_string) \ |
| 27 | static ssize_t show_##field (struct device *dev, char *buf) \ | 27 | static ssize_t show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
| 28 | { \ | 28 | { \ |
| 29 | struct usb_device *udev; \ | 29 | struct usb_device *udev; \ |
| 30 | struct usb_host_config *actconfig; \ | 30 | struct usb_host_config *actconfig; \ |
| @@ -46,7 +46,7 @@ usb_actconfig_attr (bNumInterfaces, 1, "%2d\n") | |||
| 46 | usb_actconfig_attr (bmAttributes, 1, "%2x\n") | 46 | usb_actconfig_attr (bmAttributes, 1, "%2x\n") |
| 47 | usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") | 47 | usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") |
| 48 | 48 | ||
| 49 | static ssize_t show_configuration_string(struct device *dev, char *buf) | 49 | static ssize_t show_configuration_string(struct device *dev, struct device_attribute *attr, char *buf) |
| 50 | { | 50 | { |
| 51 | struct usb_device *udev; | 51 | struct usb_device *udev; |
| 52 | struct usb_host_config *actconfig; | 52 | struct usb_host_config *actconfig; |
| @@ -69,7 +69,7 @@ static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL); | |||
| 69 | usb_actconfig_show(bConfigurationValue, 1, "%u\n"); | 69 | usb_actconfig_show(bConfigurationValue, 1, "%u\n"); |
| 70 | 70 | ||
| 71 | static ssize_t | 71 | static ssize_t |
| 72 | set_bConfigurationValue (struct device *dev, const char *buf, size_t count) | 72 | set_bConfigurationValue (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
| 73 | { | 73 | { |
| 74 | struct usb_device *udev = udev = to_usb_device (dev); | 74 | struct usb_device *udev = udev = to_usb_device (dev); |
| 75 | int config, value; | 75 | int config, value; |
| @@ -87,7 +87,7 @@ static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, | |||
| 87 | 87 | ||
| 88 | /* String fields */ | 88 | /* String fields */ |
| 89 | #define usb_string_attr(name) \ | 89 | #define usb_string_attr(name) \ |
| 90 | static ssize_t show_##name(struct device *dev, char *buf) \ | 90 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
| 91 | { \ | 91 | { \ |
| 92 | struct usb_device *udev; \ | 92 | struct usb_device *udev; \ |
| 93 | int len; \ | 93 | int len; \ |
| @@ -107,7 +107,7 @@ usb_string_attr(manufacturer); | |||
| 107 | usb_string_attr(serial); | 107 | usb_string_attr(serial); |
| 108 | 108 | ||
| 109 | static ssize_t | 109 | static ssize_t |
| 110 | show_speed (struct device *dev, char *buf) | 110 | show_speed (struct device *dev, struct device_attribute *attr, char *buf) |
| 111 | { | 111 | { |
| 112 | struct usb_device *udev; | 112 | struct usb_device *udev; |
| 113 | char *speed; | 113 | char *speed; |
| @@ -133,7 +133,7 @@ show_speed (struct device *dev, char *buf) | |||
| 133 | static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); | 133 | static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); |
| 134 | 134 | ||
| 135 | static ssize_t | 135 | static ssize_t |
| 136 | show_devnum (struct device *dev, char *buf) | 136 | show_devnum (struct device *dev, struct device_attribute *attr, char *buf) |
| 137 | { | 137 | { |
| 138 | struct usb_device *udev; | 138 | struct usb_device *udev; |
| 139 | 139 | ||
| @@ -143,7 +143,7 @@ show_devnum (struct device *dev, char *buf) | |||
| 143 | static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); | 143 | static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); |
| 144 | 144 | ||
| 145 | static ssize_t | 145 | static ssize_t |
| 146 | show_version (struct device *dev, char *buf) | 146 | show_version (struct device *dev, struct device_attribute *attr, char *buf) |
| 147 | { | 147 | { |
| 148 | struct usb_device *udev; | 148 | struct usb_device *udev; |
| 149 | u16 bcdUSB; | 149 | u16 bcdUSB; |
| @@ -155,7 +155,7 @@ show_version (struct device *dev, char *buf) | |||
| 155 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | 155 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
| 156 | 156 | ||
| 157 | static ssize_t | 157 | static ssize_t |
| 158 | show_maxchild (struct device *dev, char *buf) | 158 | show_maxchild (struct device *dev, struct device_attribute *attr, char *buf) |
| 159 | { | 159 | { |
| 160 | struct usb_device *udev; | 160 | struct usb_device *udev; |
| 161 | 161 | ||
| @@ -167,7 +167,7 @@ static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL); | |||
| 167 | /* Descriptor fields */ | 167 | /* Descriptor fields */ |
| 168 | #define usb_descriptor_attr_le16(field, format_string) \ | 168 | #define usb_descriptor_attr_le16(field, format_string) \ |
| 169 | static ssize_t \ | 169 | static ssize_t \ |
| 170 | show_##field (struct device *dev, char *buf) \ | 170 | show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
| 171 | { \ | 171 | { \ |
| 172 | struct usb_device *udev; \ | 172 | struct usb_device *udev; \ |
| 173 | \ | 173 | \ |
| @@ -183,7 +183,7 @@ usb_descriptor_attr_le16(bcdDevice, "%04x\n") | |||
| 183 | 183 | ||
| 184 | #define usb_descriptor_attr(field, format_string) \ | 184 | #define usb_descriptor_attr(field, format_string) \ |
| 185 | static ssize_t \ | 185 | static ssize_t \ |
| 186 | show_##field (struct device *dev, char *buf) \ | 186 | show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
| 187 | { \ | 187 | { \ |
| 188 | struct usb_device *udev; \ | 188 | struct usb_device *udev; \ |
| 189 | \ | 189 | \ |
| @@ -254,7 +254,7 @@ void usb_remove_sysfs_dev_files (struct usb_device *udev) | |||
| 254 | /* Interface fields */ | 254 | /* Interface fields */ |
| 255 | #define usb_intf_attr(field, format_string) \ | 255 | #define usb_intf_attr(field, format_string) \ |
| 256 | static ssize_t \ | 256 | static ssize_t \ |
| 257 | show_##field (struct device *dev, char *buf) \ | 257 | show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
| 258 | { \ | 258 | { \ |
| 259 | struct usb_interface *intf = to_usb_interface (dev); \ | 259 | struct usb_interface *intf = to_usb_interface (dev); \ |
| 260 | \ | 260 | \ |
| @@ -269,7 +269,7 @@ usb_intf_attr (bInterfaceClass, "%02x\n") | |||
| 269 | usb_intf_attr (bInterfaceSubClass, "%02x\n") | 269 | usb_intf_attr (bInterfaceSubClass, "%02x\n") |
| 270 | usb_intf_attr (bInterfaceProtocol, "%02x\n") | 270 | usb_intf_attr (bInterfaceProtocol, "%02x\n") |
| 271 | 271 | ||
| 272 | static ssize_t show_interface_string(struct device *dev, char *buf) | 272 | static ssize_t show_interface_string(struct device *dev, struct device_attribute *attr, char *buf) |
| 273 | { | 273 | { |
| 274 | struct usb_interface *intf; | 274 | struct usb_interface *intf; |
| 275 | struct usb_device *udev; | 275 | struct usb_device *udev; |
| @@ -286,36 +286,34 @@ static ssize_t show_interface_string(struct device *dev, char *buf) | |||
| 286 | } | 286 | } |
| 287 | static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); | 287 | static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); |
| 288 | 288 | ||
| 289 | static ssize_t show_modalias(struct device *dev, char *buf) | 289 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) |
| 290 | { | 290 | { |
| 291 | struct usb_interface *intf; | 291 | struct usb_interface *intf; |
| 292 | struct usb_device *udev; | 292 | struct usb_device *udev; |
| 293 | int len; | ||
| 293 | 294 | ||
| 294 | intf = to_usb_interface(dev); | 295 | intf = to_usb_interface(dev); |
| 295 | udev = interface_to_usbdev(intf); | 296 | udev = interface_to_usbdev(intf); |
| 296 | if (udev->descriptor.bDeviceClass == 0) { | ||
| 297 | struct usb_host_interface *alt = intf->cur_altsetting; | ||
| 298 | 297 | ||
| 299 | return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X\n", | 298 | len = sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic", |
| 300 | le16_to_cpu(udev->descriptor.idVendor), | 299 | le16_to_cpu(udev->descriptor.idVendor), |
| 301 | le16_to_cpu(udev->descriptor.idProduct), | 300 | le16_to_cpu(udev->descriptor.idProduct), |
| 302 | le16_to_cpu(udev->descriptor.bcdDevice), | 301 | le16_to_cpu(udev->descriptor.bcdDevice), |
| 303 | udev->descriptor.bDeviceClass, | 302 | udev->descriptor.bDeviceClass, |
| 304 | udev->descriptor.bDeviceSubClass, | 303 | udev->descriptor.bDeviceSubClass, |
| 305 | udev->descriptor.bDeviceProtocol, | 304 | udev->descriptor.bDeviceProtocol); |
| 305 | buf += len; | ||
| 306 | |||
| 307 | if (udev->descriptor.bDeviceClass == 0) { | ||
| 308 | struct usb_host_interface *alt = intf->cur_altsetting; | ||
| 309 | |||
| 310 | return len + sprintf(buf, "%02Xisc%02Xip%02X\n", | ||
| 306 | alt->desc.bInterfaceClass, | 311 | alt->desc.bInterfaceClass, |
| 307 | alt->desc.bInterfaceSubClass, | 312 | alt->desc.bInterfaceSubClass, |
| 308 | alt->desc.bInterfaceProtocol); | 313 | alt->desc.bInterfaceProtocol); |
| 309 | } else { | 314 | } else { |
| 310 | return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*\n", | 315 | return len + sprintf(buf, "*isc*ip*\n"); |
| 311 | le16_to_cpu(udev->descriptor.idVendor), | ||
| 312 | le16_to_cpu(udev->descriptor.idProduct), | ||
| 313 | le16_to_cpu(udev->descriptor.bcdDevice), | ||
| 314 | udev->descriptor.bDeviceClass, | ||
| 315 | udev->descriptor.bDeviceSubClass, | ||
| 316 | udev->descriptor.bDeviceProtocol); | ||
| 317 | } | 316 | } |
| 318 | |||
| 319 | } | 317 | } |
| 320 | static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); | 318 | static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); |
| 321 | 319 | ||
