aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devio.c34
-rw-r--r--drivers/usb/core/usb.h1
2 files changed, 17 insertions, 18 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 6c15dabcfc0b..9222b7a13430 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -517,6 +517,23 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
517 return ret; 517 return ret;
518} 518}
519 519
520static struct usb_device *usbdev_lookup_minor(int minor)
521{
522 struct class_device *class_dev;
523 struct usb_device *dev = NULL;
524
525 down(&usb_device_class->sem);
526 list_for_each_entry(class_dev, &usb_device_class->children, node) {
527 if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
528 dev = class_dev->class_data;
529 break;
530 }
531 }
532 up(&usb_device_class->sem);
533
534 return dev;
535};
536
520/* 537/*
521 * file operations 538 * file operations
522 */ 539 */
@@ -1533,23 +1550,6 @@ struct file_operations usbfs_device_file_operations = {
1533 .release = usbdev_release, 1550 .release = usbdev_release,
1534}; 1551};
1535 1552
1536struct usb_device *usbdev_lookup_minor(int minor)
1537{
1538 struct class_device *class_dev;
1539 struct usb_device *dev = NULL;
1540
1541 down(&usb_device_class->sem);
1542 list_for_each_entry(class_dev, &usb_device_class->children, node) {
1543 if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
1544 dev = class_dev->class_data;
1545 break;
1546 }
1547 }
1548 up(&usb_device_class->sem);
1549
1550 return dev;
1551};
1552
1553void usbdev_add(struct usb_device *dev) 1553void usbdev_add(struct usb_device *dev)
1554{ 1554{
1555 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); 1555 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 4d59f6e07999..3dc8096c0f92 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -64,7 +64,6 @@ extern int usbdev_init(void);
64extern void usbdev_cleanup(void); 64extern void usbdev_cleanup(void);
65extern void usbdev_add(struct usb_device *dev); 65extern void usbdev_add(struct usb_device *dev);
66extern void usbdev_remove(struct usb_device *dev); 66extern void usbdev_remove(struct usb_device *dev);
67extern struct usb_device *usbdev_lookup_minor(int minor);
68 67
69struct dev_state { 68struct dev_state {
70 struct list_head list; /* state list */ 69 struct list_head list; /* state list */