diff options
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-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); |