diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 7 | ||||
-rw-r--r-- | drivers/media/video/dabusb.c | 6 | ||||
-rw-r--r-- | drivers/usb/class/usblp.c | 6 | ||||
-rw-r--r-- | drivers/usb/core/file.c | 13 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 11 | ||||
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 6 |
7 files changed, 53 insertions, 2 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index e9b436d2d944..9e9421525fb9 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -850,8 +850,14 @@ static const struct file_operations hiddev_fops = { | |||
850 | #endif | 850 | #endif |
851 | }; | 851 | }; |
852 | 852 | ||
853 | static char *hiddev_nodename(struct device *dev) | ||
854 | { | ||
855 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | ||
856 | } | ||
857 | |||
853 | static struct usb_class_driver hiddev_class = { | 858 | static struct usb_class_driver hiddev_class = { |
854 | .name = "hiddev%d", | 859 | .name = "hiddev%d", |
860 | .nodename = hiddev_nodename, | ||
855 | .fops = &hiddev_fops, | 861 | .fops = &hiddev_fops, |
856 | .minor_base = HIDDEV_MINOR_BASE, | 862 | .minor_base = HIDDEV_MINOR_BASE, |
857 | }; | 863 | }; |
@@ -955,7 +961,6 @@ static int hiddev_usbd_probe(struct usb_interface *intf, | |||
955 | return -ENODEV; | 961 | return -ENODEV; |
956 | } | 962 | } |
957 | 963 | ||
958 | |||
959 | static /* const */ struct usb_driver hiddev_driver = { | 964 | static /* const */ struct usb_driver hiddev_driver = { |
960 | .name = "hiddev", | 965 | .name = "hiddev", |
961 | .probe = hiddev_usbd_probe, | 966 | .probe = hiddev_usbd_probe, |
diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c index ba3709bec3f0..ec2f45dde164 100644 --- a/drivers/media/video/dabusb.c +++ b/drivers/media/video/dabusb.c | |||
@@ -747,8 +747,14 @@ static const struct file_operations dabusb_fops = | |||
747 | .release = dabusb_release, | 747 | .release = dabusb_release, |
748 | }; | 748 | }; |
749 | 749 | ||
750 | static char *dabusb_nodename(struct device *dev) | ||
751 | { | ||
752 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | ||
753 | } | ||
754 | |||
750 | static struct usb_class_driver dabusb_class = { | 755 | static struct usb_class_driver dabusb_class = { |
751 | .name = "dabusb%d", | 756 | .name = "dabusb%d", |
757 | .nodename = dabusb_nodename, | ||
752 | .fops = &dabusb_fops, | 758 | .fops = &dabusb_fops, |
753 | .minor_base = DABUSB_MINOR, | 759 | .minor_base = DABUSB_MINOR, |
754 | }; | 760 | }; |
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index d2747a49b974..26c09f0257db 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c | |||
@@ -1057,8 +1057,14 @@ static const struct file_operations usblp_fops = { | |||
1057 | .release = usblp_release, | 1057 | .release = usblp_release, |
1058 | }; | 1058 | }; |
1059 | 1059 | ||
1060 | static char *usblp_nodename(struct device *dev) | ||
1061 | { | ||
1062 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | ||
1063 | } | ||
1064 | |||
1060 | static struct usb_class_driver usblp_class = { | 1065 | static struct usb_class_driver usblp_class = { |
1061 | .name = "lp%d", | 1066 | .name = "lp%d", |
1067 | .nodename = usblp_nodename, | ||
1062 | .fops = &usblp_fops, | 1068 | .fops = &usblp_fops, |
1063 | .minor_base = USBLP_MINOR_BASE, | 1069 | .minor_base = USBLP_MINOR_BASE, |
1064 | }; | 1070 | }; |
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); |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 7eee400d3e32..927a27dd2f85 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -305,10 +305,21 @@ static struct dev_pm_ops usb_device_pm_ops = { | |||
305 | 305 | ||
306 | #endif /* CONFIG_PM */ | 306 | #endif /* CONFIG_PM */ |
307 | 307 | ||
308 | |||
309 | static char *usb_nodename(struct device *dev) | ||
310 | { | ||
311 | struct usb_device *usb_dev; | ||
312 | |||
313 | usb_dev = to_usb_device(dev); | ||
314 | return kasprintf(GFP_KERNEL, "bus/usb/%03d/%03d", | ||
315 | usb_dev->bus->busnum, usb_dev->devnum); | ||
316 | } | ||
317 | |||
308 | struct device_type usb_device_type = { | 318 | struct device_type usb_device_type = { |
309 | .name = "usb_device", | 319 | .name = "usb_device", |
310 | .release = usb_release_dev, | 320 | .release = usb_release_dev, |
311 | .uevent = usb_dev_uevent, | 321 | .uevent = usb_dev_uevent, |
322 | .nodename = usb_nodename, | ||
312 | .pm = &usb_device_pm_ops, | 323 | .pm = &usb_device_pm_ops, |
313 | }; | 324 | }; |
314 | 325 | ||
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index a4ef77ef917d..3c5fe5cee05a 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -726,12 +726,18 @@ static const struct file_operations iowarrior_fops = { | |||
726 | .poll = iowarrior_poll, | 726 | .poll = iowarrior_poll, |
727 | }; | 727 | }; |
728 | 728 | ||
729 | static char *iowarrior_nodename(struct device *dev) | ||
730 | { | ||
731 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | ||
732 | } | ||
733 | |||
729 | /* | 734 | /* |
730 | * usb class driver info in order to get a minor number from the usb core, | 735 | * usb class driver info in order to get a minor number from the usb core, |
731 | * and to have the device registered with devfs and the driver core | 736 | * and to have the device registered with devfs and the driver core |
732 | */ | 737 | */ |
733 | static struct usb_class_driver iowarrior_class = { | 738 | static struct usb_class_driver iowarrior_class = { |
734 | .name = "iowarrior%d", | 739 | .name = "iowarrior%d", |
740 | .nodename = iowarrior_nodename, | ||
735 | .fops = &iowarrior_fops, | 741 | .fops = &iowarrior_fops, |
736 | .minor_base = IOWARRIOR_MINOR_BASE, | 742 | .minor_base = IOWARRIOR_MINOR_BASE, |
737 | }; | 743 | }; |
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index ab0f3226158b..c1e2433f640d 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -266,12 +266,18 @@ static const struct file_operations tower_fops = { | |||
266 | .llseek = tower_llseek, | 266 | .llseek = tower_llseek, |
267 | }; | 267 | }; |
268 | 268 | ||
269 | static char *legousbtower_nodename(struct device *dev) | ||
270 | { | ||
271 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | ||
272 | } | ||
273 | |||
269 | /* | 274 | /* |
270 | * usb class driver info in order to get a minor number from the usb core, | 275 | * usb class driver info in order to get a minor number from the usb core, |
271 | * and to have the device registered with the driver core | 276 | * and to have the device registered with the driver core |
272 | */ | 277 | */ |
273 | static struct usb_class_driver tower_class = { | 278 | static struct usb_class_driver tower_class = { |
274 | .name = "legousbtower%d", | 279 | .name = "legousbtower%d", |
280 | .nodename = legousbtower_nodename, | ||
275 | .fops = &tower_fops, | 281 | .fops = &tower_fops, |
276 | .minor_base = LEGO_USB_TOWER_MINOR_BASE, | 282 | .minor_base = LEGO_USB_TOWER_MINOR_BASE, |
277 | }; | 283 | }; |