diff options
| -rw-r--r-- | drivers/usb/core/devio.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index bbd029f68faa..57bedcebf96c 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
| @@ -550,20 +550,16 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, | |||
| 550 | return ret; | 550 | return ret; |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | static int __match_minor(struct device *dev, void *data) | 553 | static int match_devt(struct device *dev, void *data) |
| 554 | { | 554 | { |
| 555 | int minor = *((int *)data); | 555 | return (dev->devt == (dev_t) data); |
| 556 | |||
| 557 | if (dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) | ||
| 558 | return 1; | ||
| 559 | return 0; | ||
| 560 | } | 556 | } |
| 561 | 557 | ||
| 562 | static struct usb_device *usbdev_lookup_by_minor(int minor) | 558 | static struct usb_device *usbdev_lookup_by_devt(dev_t devt) |
| 563 | { | 559 | { |
| 564 | struct device *dev; | 560 | struct device *dev; |
| 565 | 561 | ||
| 566 | dev = bus_find_device(&usb_bus_type, NULL, &minor, __match_minor); | 562 | dev = bus_find_device(&usb_bus_type, NULL, (void *) devt, match_devt); |
| 567 | if (!dev) | 563 | if (!dev) |
| 568 | return NULL; | 564 | return NULL; |
| 569 | put_device(dev); | 565 | put_device(dev); |
| @@ -589,9 +585,10 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
| 589 | goto out; | 585 | goto out; |
| 590 | 586 | ||
| 591 | ret = -ENOENT; | 587 | ret = -ENOENT; |
| 588 | |||
| 592 | /* usbdev device-node */ | 589 | /* usbdev device-node */ |
| 593 | if (imajor(inode) == USB_DEVICE_MAJOR) | 590 | if (imajor(inode) == USB_DEVICE_MAJOR) |
| 594 | dev = usbdev_lookup_by_minor(iminor(inode)); | 591 | dev = usbdev_lookup_by_devt(inode->i_rdev); |
| 595 | #ifdef CONFIG_USB_DEVICEFS | 592 | #ifdef CONFIG_USB_DEVICEFS |
| 596 | /* procfs file */ | 593 | /* procfs file */ |
| 597 | if (!dev) | 594 | if (!dev) |
