summaryrefslogtreecommitdiff
path: root/drivers/usb/misc/yurex.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-17 13:35:45 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-23 15:54:03 +0300
commit499841e678f911f894b2ef0cc4a6350bf11b15c6 (patch)
treeb94f37250fa351aaed5f9a21ec1a064c8ebed150 /drivers/usb/misc/yurex.c
parent9fdc1c6fdfa0bdf1854c3c06f002e6a76155fa2b (diff)
downloadlinux-499841e678f911f894b2ef0cc4a6350bf11b15c6.tar.xz
USB: yurex: refactor endpoint retrieval
Use the new endpoint helpers to lookup the required interrupt-in endpoint. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/yurex.c')
-rw-r--r--drivers/usb/misc/yurex.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 54e53ac4c08f..58abdf28620a 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -195,8 +195,8 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int retval = -ENOMEM;
- int i;
DEFINE_WAIT(wait);
+ int res;
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -212,20 +212,14 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
/* set up the endpoint information */
iface_desc = interface->cur_altsetting;
- for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
- endpoint = &iface_desc->endpoint[i].desc;
-
- if (usb_endpoint_is_int_in(endpoint)) {
- dev->int_in_endpointAddr = endpoint->bEndpointAddress;
- break;
- }
- }
- if (!dev->int_in_endpointAddr) {
- retval = -ENODEV;
+ res = usb_find_int_in_endpoint(iface_desc, &endpoint);
+ if (res) {
dev_err(&interface->dev, "Could not find endpoints\n");
+ retval = res;
goto error;
}
+ dev->int_in_endpointAddr = endpoint->bEndpointAddress;
/* allocate control URB */
dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL);