diff options
author | Matthias Kaehlcke <matthias@kaehlcke.net> | 2009-04-15 16:28:32 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:44:42 -0400 |
commit | fa4c86a0dda8dd508f2542d97febe674d2e686cc (patch) | |
tree | 10dab12ce37ec683e862c8e462e4244ad4bfe75a /drivers/usb/gadget | |
parent | 9ab1565151dff37a7d7687bfe5cfafb62c7d5e49 (diff) |
USB: gadgetfs: use helper functions to determine endpoint type and direction
Use helper functions to determine the type and direction of an endpoint
instead of fiddling with bEndpointAddress and bmAttributes
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/inode.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index d20937f28a19..7d33f50b5874 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -384,9 +384,8 @@ ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
384 | return value; | 384 | return value; |
385 | 385 | ||
386 | /* halt any endpoint by doing a "wrong direction" i/o call */ | 386 | /* halt any endpoint by doing a "wrong direction" i/o call */ |
387 | if (data->desc.bEndpointAddress & USB_DIR_IN) { | 387 | if (usb_endpoint_dir_in(&data->desc)) { |
388 | if ((data->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 388 | if (usb_endpoint_xfer_isoc(&data->desc)) |
389 | == USB_ENDPOINT_XFER_ISOC) | ||
390 | return -EINVAL; | 389 | return -EINVAL; |
391 | DBG (data->dev, "%s halt\n", data->name); | 390 | DBG (data->dev, "%s halt\n", data->name); |
392 | spin_lock_irq (&data->dev->lock); | 391 | spin_lock_irq (&data->dev->lock); |
@@ -428,9 +427,8 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
428 | return value; | 427 | return value; |
429 | 428 | ||
430 | /* halt any endpoint by doing a "wrong direction" i/o call */ | 429 | /* halt any endpoint by doing a "wrong direction" i/o call */ |
431 | if (!(data->desc.bEndpointAddress & USB_DIR_IN)) { | 430 | if (!usb_endpoint_dir_in(&data->desc)) { |
432 | if ((data->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 431 | if (usb_endpoint_xfer_isoc(&data->desc)) |
433 | == USB_ENDPOINT_XFER_ISOC) | ||
434 | return -EINVAL; | 432 | return -EINVAL; |
435 | DBG (data->dev, "%s halt\n", data->name); | 433 | DBG (data->dev, "%s halt\n", data->name); |
436 | spin_lock_irq (&data->dev->lock); | 434 | spin_lock_irq (&data->dev->lock); |
@@ -691,7 +689,7 @@ ep_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
691 | struct ep_data *epdata = iocb->ki_filp->private_data; | 689 | struct ep_data *epdata = iocb->ki_filp->private_data; |
692 | char *buf; | 690 | char *buf; |
693 | 691 | ||
694 | if (unlikely(epdata->desc.bEndpointAddress & USB_DIR_IN)) | 692 | if (unlikely(usb_endpoint_dir_in(&epdata->desc))) |
695 | return -EINVAL; | 693 | return -EINVAL; |
696 | 694 | ||
697 | buf = kmalloc(iocb->ki_left, GFP_KERNEL); | 695 | buf = kmalloc(iocb->ki_left, GFP_KERNEL); |
@@ -711,7 +709,7 @@ ep_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
711 | size_t len = 0; | 709 | size_t len = 0; |
712 | int i = 0; | 710 | int i = 0; |
713 | 711 | ||
714 | if (unlikely(!(epdata->desc.bEndpointAddress & USB_DIR_IN))) | 712 | if (unlikely(!usb_endpoint_dir_in(&epdata->desc))) |
715 | return -EINVAL; | 713 | return -EINVAL; |
716 | 714 | ||
717 | buf = kmalloc(iocb->ki_left, GFP_KERNEL); | 715 | buf = kmalloc(iocb->ki_left, GFP_KERNEL); |