diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-04-30 09:23:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:30:25 -0400 |
commit | f7a386c5b8ff34cd84ae922603d1c6f9d234edee (patch) | |
tree | ae1c03544dd511d85cc537c632eba6f035072e36 /drivers/usb/core/file.c | |
parent | d405640539555b601e52f7d18f1f0b1345d18bf5 (diff) |
Driver Core: usb: add nodename support for usb drivers.
This adds support for USB drivers to report their requested nodename to
userspace. It also updates a number of USB drivers to provide the
needed subdirectory and device name to be used for them.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/file.c')
-rw-r--r-- | drivers/usb/core/file.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 997e659ff693..5cef88929b3e 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -67,6 +67,16 @@ static struct usb_class { | |||
67 | struct class *class; | 67 | struct class *class; |
68 | } *usb_class; | 68 | } *usb_class; |
69 | 69 | ||
70 | static char *usb_nodename(struct device *dev) | ||
71 | { | ||
72 | struct usb_class_driver *drv; | ||
73 | |||
74 | drv = dev_get_drvdata(dev); | ||
75 | if (!drv || !drv->nodename) | ||
76 | return NULL; | ||
77 | return drv->nodename(dev); | ||
78 | } | ||
79 | |||
70 | static int init_usb_class(void) | 80 | static int init_usb_class(void) |
71 | { | 81 | { |
72 | int result = 0; | 82 | int result = 0; |
@@ -90,6 +100,7 @@ static int init_usb_class(void) | |||
90 | kfree(usb_class); | 100 | kfree(usb_class); |
91 | usb_class = NULL; | 101 | usb_class = NULL; |
92 | } | 102 | } |
103 | usb_class->class->nodename = usb_nodename; | ||
93 | 104 | ||
94 | exit: | 105 | exit: |
95 | return result; | 106 | return result; |
@@ -198,7 +209,7 @@ int usb_register_dev(struct usb_interface *intf, | |||
198 | else | 209 | else |
199 | temp = name; | 210 | temp = name; |
200 | intf->usb_dev = device_create(usb_class->class, &intf->dev, | 211 | intf->usb_dev = device_create(usb_class->class, &intf->dev, |
201 | MKDEV(USB_MAJOR, minor), NULL, | 212 | MKDEV(USB_MAJOR, minor), class_driver, |
202 | "%s", temp); | 213 | "%s", temp); |
203 | if (IS_ERR(intf->usb_dev)) { | 214 | if (IS_ERR(intf->usb_dev)) { |
204 | down_write(&minor_rwsem); | 215 | down_write(&minor_rwsem); |