USB: idmouse: refactor endpoint retrieval
Use the new endpoint helpers to lookup the required bulk-in endpoint. Note that we now pick the first bulk-in endpoint regardless of whether it happens to be the first descriptor. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
50129f7454
commit
fa38442eaa
@@ -357,26 +357,22 @@ static int idmouse_probe(struct usb_interface *interface,
|
|||||||
dev->interface = interface;
|
dev->interface = interface;
|
||||||
|
|
||||||
/* set up the endpoint information - use only the first bulk-in endpoint */
|
/* set up the endpoint information - use only the first bulk-in endpoint */
|
||||||
endpoint = &iface_desc->endpoint[0].desc;
|
result = usb_find_bulk_in_endpoint(iface_desc, &endpoint);
|
||||||
if (!dev->bulk_in_endpointAddr && usb_endpoint_is_bulk_in(endpoint)) {
|
if (result) {
|
||||||
/* we found a bulk in endpoint */
|
dev_err(&interface->dev, "Unable to find bulk-in endpoint.\n");
|
||||||
|
idmouse_delete(dev);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
dev->orig_bi_size = usb_endpoint_maxp(endpoint);
|
dev->orig_bi_size = usb_endpoint_maxp(endpoint);
|
||||||
dev->bulk_in_size = 0x200; /* works _much_ faster */
|
dev->bulk_in_size = 0x200; /* works _much_ faster */
|
||||||
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
|
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
|
||||||
dev->bulk_in_buffer =
|
dev->bulk_in_buffer = kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL);
|
||||||
kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL);
|
|
||||||
|
|
||||||
if (!dev->bulk_in_buffer) {
|
if (!dev->bulk_in_buffer) {
|
||||||
idmouse_delete(dev);
|
idmouse_delete(dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!(dev->bulk_in_endpointAddr)) {
|
|
||||||
dev_err(&interface->dev, "Unable to find bulk-in endpoint.\n");
|
|
||||||
idmouse_delete(dev);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
/* allow device read, write and ioctl */
|
/* allow device read, write and ioctl */
|
||||||
dev->present = 1;
|
dev->present = 1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user