diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-10-24 16:24:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:51 -0400 |
commit | 4f62efe67f077db17dad03a1d4c9665000a3eb45 (patch) | |
tree | 27f1837fd08ce3dccb94a88a5afef6eb1a5ed738 /drivers/usb/core/hub.c | |
parent | 16f16d117c1eb99451e4c73c87546eef05c66790 (diff) |
[PATCH] usbcore: Fix handling of sysfs strings and other attributes
This patch (as592) makes a few small improvements to the way device
strings are handled, and it fixes some bugs in a couple of other sysfs
attribute routines. (Look at show_configuration_string() to see what I
mean.)
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r-- | drivers/usb/core/hub.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8ba5854e538..1bacb374b00 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1204,21 +1204,6 @@ static inline void show_string(struct usb_device *udev, char *id, char *string) | |||
1204 | {} | 1204 | {} |
1205 | #endif | 1205 | #endif |
1206 | 1206 | ||
1207 | static void get_string(struct usb_device *udev, char **string, int index) | ||
1208 | { | ||
1209 | char *buf; | ||
1210 | |||
1211 | if (!index) | ||
1212 | return; | ||
1213 | buf = kmalloc(256, GFP_KERNEL); | ||
1214 | if (!buf) | ||
1215 | return; | ||
1216 | if (usb_string(udev, index, buf, 256) > 0) | ||
1217 | *string = buf; | ||
1218 | else | ||
1219 | kfree(buf); | ||
1220 | } | ||
1221 | |||
1222 | 1207 | ||
1223 | #ifdef CONFIG_USB_OTG | 1208 | #ifdef CONFIG_USB_OTG |
1224 | #include "otg_whitelist.h" | 1209 | #include "otg_whitelist.h" |
@@ -1257,9 +1242,10 @@ int usb_new_device(struct usb_device *udev) | |||
1257 | } | 1242 | } |
1258 | 1243 | ||
1259 | /* read the standard strings and cache them if present */ | 1244 | /* read the standard strings and cache them if present */ |
1260 | get_string(udev, &udev->product, udev->descriptor.iProduct); | 1245 | udev->product = usb_cache_string(udev, udev->descriptor.iProduct); |
1261 | get_string(udev, &udev->manufacturer, udev->descriptor.iManufacturer); | 1246 | udev->manufacturer = usb_cache_string(udev, |
1262 | get_string(udev, &udev->serial, udev->descriptor.iSerialNumber); | 1247 | udev->descriptor.iManufacturer); |
1248 | udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber); | ||
1263 | 1249 | ||
1264 | /* Tell the world! */ | 1250 | /* Tell the world! */ |
1265 | dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, " | 1251 | dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, " |