diff options
author | Jimmy Assarsson <extja@kvaser.com> | 2018-07-19 00:29:23 +0300 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-07-27 11:40:19 +0300 |
commit | 99ce1bc1746266a20e91417b600533e82d57734d (patch) | |
tree | b99dcff85fb5644c8c0c9d39cb8360bfafb58de1 /drivers/net/can | |
parent | 0e30619fd6fae62c58d76e739b8ba7a14c52c4bd (diff) | |
download | linux-99ce1bc1746266a20e91417b600533e82d57734d.tar.xz |
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: Jimmy Assarsson <extja@kvaser.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/usb/kvaser_usb.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 9e0e2c852943..cb3a2d6d3ba4 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -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; |