mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
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>
This commit is contained in:
parent
9fdc1c6fdf
commit
499841e678
@ -195,8 +195,8 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|||||||
struct usb_host_interface *iface_desc;
|
struct usb_host_interface *iface_desc;
|
||||||
struct usb_endpoint_descriptor *endpoint;
|
struct usb_endpoint_descriptor *endpoint;
|
||||||
int retval = -ENOMEM;
|
int retval = -ENOMEM;
|
||||||
int i;
|
|
||||||
DEFINE_WAIT(wait);
|
DEFINE_WAIT(wait);
|
||||||
|
int res;
|
||||||
|
|
||||||
/* allocate memory for our device state and initialize it */
|
/* allocate memory for our device state and initialize it */
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
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 */
|
/* set up the endpoint information */
|
||||||
iface_desc = interface->cur_altsetting;
|
iface_desc = interface->cur_altsetting;
|
||||||
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
|
res = usb_find_int_in_endpoint(iface_desc, &endpoint);
|
||||||
endpoint = &iface_desc->endpoint[i].desc;
|
if (res) {
|
||||||
|
|
||||||
if (usb_endpoint_is_int_in(endpoint)) {
|
|
||||||
dev->int_in_endpointAddr = endpoint->bEndpointAddress;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!dev->int_in_endpointAddr) {
|
|
||||||
retval = -ENODEV;
|
|
||||||
dev_err(&interface->dev, "Could not find endpoints\n");
|
dev_err(&interface->dev, "Could not find endpoints\n");
|
||||||
|
retval = res;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev->int_in_endpointAddr = endpoint->bEndpointAddress;
|
||||||
|
|
||||||
/* allocate control URB */
|
/* allocate control URB */
|
||||||
dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL);
|
dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
|
Loading…
Reference in New Issue
Block a user