Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104616
b: refs/heads/master
c: 61ad04a
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jul 21, 2008
1 parent 3f8b4e7 commit 3030945
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cd9f03759d3eb588e185b04e1854c778b050833e
refs/heads/master: 61ad04a89f0e3e6adaed0d9adfc0c9b431ccbb92
15 changes: 6 additions & 9 deletions trunk/drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,20 +550,16 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
return ret;
}

static int __match_minor(struct device *dev, void *data)
static int match_devt(struct device *dev, void *data)
{
int minor = *((int *)data);

if (dev->devt == MKDEV(USB_DEVICE_MAJOR, minor))
return 1;
return 0;
return (dev->devt == (dev_t) data);
}

static struct usb_device *usbdev_lookup_by_minor(int minor)
static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
{
struct device *dev;

dev = bus_find_device(&usb_bus_type, NULL, &minor, __match_minor);
dev = bus_find_device(&usb_bus_type, NULL, (void *) devt, match_devt);
if (!dev)
return NULL;
put_device(dev);
Expand All @@ -589,9 +585,10 @@ static int usbdev_open(struct inode *inode, struct file *file)
goto out;

ret = -ENOENT;

/* usbdev device-node */
if (imajor(inode) == USB_DEVICE_MAJOR)
dev = usbdev_lookup_by_minor(iminor(inode));
dev = usbdev_lookup_by_devt(inode->i_rdev);
#ifdef CONFIG_USB_DEVICEFS
/* procfs file */
if (!dev)
Expand Down

0 comments on commit 3030945

Please sign in to comment.