aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-10-24 16:24:14 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 16:47:51 -0700
commit4f62efe67f077db17dad03a1d4c9665000a3eb45 (patch)
tree27f1837fd08ce3dccb94a88a5afef6eb1a5ed738 /drivers/usb/core/hub.c
parent16f16d117c1eb99451e4c73c87546eef05c66790 (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.c22
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)
{}
#endif
-static void get_string(struct usb_device *udev, char **string, int index)
-{
- char *buf;
-
- if (!index)
- return;
- buf = kmalloc(256, GFP_KERNEL);
- if (!buf)
- return;
- if (usb_string(udev, index, buf, 256) > 0)
- *string = buf;
- else
- kfree(buf);
-}
-
#ifdef CONFIG_USB_OTG
#include "otg_whitelist.h"
@@ -1257,9 +1242,10 @@ int usb_new_device(struct usb_device *udev)
}
/* read the standard strings and cache them if present */
- get_string(udev, &udev->product, udev->descriptor.iProduct);
- get_string(udev, &udev->manufacturer, udev->descriptor.iManufacturer);
- get_string(udev, &udev->serial, udev->descriptor.iSerialNumber);
+ udev->product = usb_cache_string(udev, udev->descriptor.iProduct);
+ udev->manufacturer = usb_cache_string(udev,
+ udev->descriptor.iManufacturer);
+ udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
/* Tell the world! */
dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, "