summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-04-25 21:15:43 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 22:28:42 +0200
commit83f7d958eab2fbc6b159ee92bf1493924e1d0f72 (patch)
treed1bb7f88a03bd8582ab5fb80f8a90fc598fb8814 /drivers
parentUSB: cxacru: ADSL state management (diff)
downloadlinux-83f7d958eab2fbc6b159ee92bf1493924e1d0f72.tar.xz
linux-83f7d958eab2fbc6b159ee92bf1493924e1d0f72.zip
USB: add "busnum" attribute for USB devices
This patch (as903) adds a "busnum" sysfs attribute for USB devices. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/sysfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 2ea47a38aefa..e7c982377488 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -118,6 +118,16 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf)
static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
static ssize_t
+show_busnum(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct usb_device *udev;
+
+ udev = to_usb_device(dev);
+ return sprintf(buf, "%d\n", udev->bus->busnum);
+}
+static DEVICE_ATTR(busnum, S_IRUGO, show_busnum, NULL);
+
+static ssize_t
show_devnum(struct device *dev, struct device_attribute *attr, char *buf)
{
struct usb_device *udev;
@@ -347,6 +357,7 @@ static struct attribute *dev_attrs[] = {
&dev_attr_bNumConfigurations.attr,
&dev_attr_bMaxPacketSize0.attr,
&dev_attr_speed.attr,
+ &dev_attr_busnum.attr,
&dev_attr_devnum.attr,
&dev_attr_version.attr,
&dev_attr_maxchild.attr,