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>
This commit is contained in:
Alan Stern
2013-07-30 15:35:40 -04:00
کامیت شده توسط Greg Kroah-Hartman
والد b977a3068a
کامیت 15b7336e02
3فایلهای تغییر یافته به همراه15 افزوده شده و 17 حذف شده

مشاهده پرونده

@@ -747,9 +747,9 @@ static int ch9_postconfig(struct usbtest_dev *dev)
/* [9.4.5] get_status always works */
retval = usb_get_status(udev, USB_RECIP_DEVICE, 0, dev->buf);
if (retval != 2) {
if (retval) {
dev_err(&iface->dev, "get dev status --> %d\n", retval);
return (retval < 0) ? retval : -EDOM;
return retval;
}
/* FIXME configuration.bmAttributes says if we could try to set/clear
@@ -758,9 +758,9 @@ static int ch9_postconfig(struct usbtest_dev *dev)
retval = usb_get_status(udev, USB_RECIP_INTERFACE,
iface->altsetting[0].desc.bInterfaceNumber, dev->buf);
if (retval != 2) {
if (retval) {
dev_err(&iface->dev, "get interface status --> %d\n", retval);
return (retval < 0) ? retval : -EDOM;
return retval;
}
/* FIXME get status for each endpoint in the interface */
@@ -1351,7 +1351,6 @@ static int verify_halted(struct usbtest_dev *tdev, int ep, struct urb *urb)
ep, retval);
return retval;
}
le16_to_cpus(&status);
if (status != 1) {
ERROR(tdev, "ep %02x bogus status: %04x != 1\n", ep, status);
return -EINVAL;