Commit 99ce1bc1 authored by Jimmy Assarsson's avatar Jimmy Assarsson Committed by Marc Kleine-Budde

can: kvaser_usb: Refactor kvaser_usb_get_endpoints()

Replace parameters with struct kvaser_usb pointer. Rename the function
from kvaser_usb_get_endpoints() to kvaser_usb_setup_endpoints().
Signed-off-by: default avatarJimmy Assarsson <extja@kvaser.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 0e30619f
......@@ -1914,27 +1914,25 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
return 0;
}
static int kvaser_usb_get_endpoints(const struct usb_interface *intf,
struct usb_endpoint_descriptor **in,
struct usb_endpoint_descriptor **out)
static int kvaser_usb_setup_endpoints(struct kvaser_usb *dev)
{
const struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int i;
iface_desc = &intf->altsetting[0];
iface_desc = &dev->intf->altsetting[0];
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
if (!*in && usb_endpoint_is_bulk_in(endpoint))
*in = endpoint;
if (!dev->bulk_in && usb_endpoint_is_bulk_in(endpoint))
dev->bulk_in = endpoint;
if (!*out && usb_endpoint_is_bulk_out(endpoint))
*out = endpoint;
if (!dev->bulk_out && usb_endpoint_is_bulk_out(endpoint))
dev->bulk_out = endpoint;
/* use first bulk endpoint for in and out */
if (*in && *out)
if (dev->bulk_in && dev->bulk_out)
return 0;
}
......@@ -1965,7 +1963,7 @@ static int kvaser_usb_probe(struct usb_interface *intf,
dev->intf = intf;
err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
err = kvaser_usb_setup_endpoints(dev);
if (err) {
dev_err(&intf->dev, "Cannot get usb endpoint(s)");
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment