linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: kvaser_usb: fix usb endpoints detection
@ 2013-10-27 21:07 Olivier Sobrie
  2013-10-27 23:29 ` Marc Kleine-Budde
  2013-10-28  9:25 ` Marc Kleine-Budde
  0 siblings, 2 replies; 7+ messages in thread
From: Olivier Sobrie @ 2013-10-27 21:07 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: Wolfgang Grandegger, linux-can, Olivier Sobrie

Some devices, like the Kvaser Memorator Professional, have several
bulk in endpoints. Only the first one found should be used by the
driver. The same holds for the bulk out endpoint.

Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
---
 drivers/net/can/usb/kvaser_usb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 3b95465..bdbf5bf 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1554,13 +1554,14 @@ static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
 
 	iface_desc = &intf->altsetting[0];
 
-	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
+	for (i = 0; (i < iface_desc->desc.bNumEndpoints) && (!*in || !*out);
+	     ++i) {
 		endpoint = &iface_desc->endpoint[i].desc;
 
-		if (usb_endpoint_is_bulk_in(endpoint))
+		if (!*in && usb_endpoint_is_bulk_in(endpoint))
 			*in = endpoint;
 
-		if (usb_endpoint_is_bulk_out(endpoint))
+		if (!*out && usb_endpoint_is_bulk_out(endpoint))
 			*out = endpoint;
 	}
 }
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-10-28 12:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-27 21:07 [PATCH] can: kvaser_usb: fix usb endpoints detection Olivier Sobrie
2013-10-27 23:29 ` Marc Kleine-Budde
2013-10-28  8:29   ` Marc Kleine-Budde
2013-10-28 12:06   ` Olivier Sobrie
2013-10-28 12:26     ` Marc Kleine-Budde
2013-10-28  9:25 ` Marc Kleine-Budde
2013-10-28 12:08   ` Olivier Sobrie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).