aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2013-07-30 15:35:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-31 20:29:02 -0400
commit15b7336e02d998720c5ace47036f7e539365bb05 (patch)
treedb90ccb73d4b50fdfab0c3a93144b9d803622c46 /drivers/usb/misc/usbtest.c
parentb977a3068a284b2ad4612cdb8ca326cbd2a7ffc9 (diff)
USB: simplify the interface of usb_get_status()
This patch simplifies the interface presented by usb_get_status(). Instead of forcing callers to check for the proper data length and convert the status value to host byte order, the function will now do these things itself. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 8b4ca1cb450a..aa28ac8c7607 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -747,9 +747,9 @@ static int ch9_postconfig(struct usbtest_dev *dev)
747 747
748 /* [9.4.5] get_status always works */ 748 /* [9.4.5] get_status always works */
749 retval = usb_get_status(udev, USB_RECIP_DEVICE, 0, dev->buf); 749 retval = usb_get_status(udev, USB_RECIP_DEVICE, 0, dev->buf);
750 if (retval != 2) { 750 if (retval) {
751 dev_err(&iface->dev, "get dev status --> %d\n", retval); 751 dev_err(&iface->dev, "get dev status --> %d\n", retval);
752 return (retval < 0) ? retval : -EDOM; 752 return retval;
753 } 753 }
754 754
755 /* FIXME configuration.bmAttributes says if we could try to set/clear 755 /* FIXME configuration.bmAttributes says if we could try to set/clear
@@ -758,9 +758,9 @@ static int ch9_postconfig(struct usbtest_dev *dev)
758 758
759 retval = usb_get_status(udev, USB_RECIP_INTERFACE, 759 retval = usb_get_status(udev, USB_RECIP_INTERFACE,
760 iface->altsetting[0].desc.bInterfaceNumber, dev->buf); 760 iface->altsetting[0].desc.bInterfaceNumber, dev->buf);
761 if (retval != 2) { 761 if (retval) {
762 dev_err(&iface->dev, "get interface status --> %d\n", retval); 762 dev_err(&iface->dev, "get interface status --> %d\n", retval);
763 return (retval < 0) ? retval : -EDOM; 763 return retval;
764 } 764 }
765 /* FIXME get status for each endpoint in the interface */ 765 /* FIXME get status for each endpoint in the interface */
766 766
@@ -1351,7 +1351,6 @@ static int verify_halted(struct usbtest_dev *tdev, int ep, struct urb *urb)
1351 ep, retval); 1351 ep, retval);
1352 return retval; 1352 return retval;
1353 } 1353 }
1354 le16_to_cpus(&status);
1355 if (status != 1) { 1354 if (status != 1) {
1356 ERROR(tdev, "ep %02x bogus status: %04x != 1\n", ep, status); 1355 ERROR(tdev, "ep %02x bogus status: %04x != 1\n", ep, status);
1357 return -EINVAL; 1356 return -EINVAL;