linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] can: kvaser_usb: fix usb endpoints detection
@ 2013-10-28  9:14 Marc Kleine-Budde
  0 siblings, 0 replies; only message in thread
From: Marc Kleine-Budde @ 2013-10-28  9:14 UTC (permalink / raw)
  To: linux-can; +Cc: Olivier Sobrie, Marc Kleine-Budde

From: Olivier Sobrie <olivier@sobrie.be>

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>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Hello,

changes since v1:
- use explizid return in loop if both in and out endpoints are found.

regards,
Marc

 drivers/net/can/usb/kvaser_usb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 3b95465..b88a8e9 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1557,11 +1557,15 @@ static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
 	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++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;
+
+		/* only use first bulk endpoint for in and out */
+		if (*in && *out)
+			return;
 	}
 }
 
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-28  9:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-28  9:14 [PATCH v2] can: kvaser_usb: fix usb endpoints detection Marc Kleine-Budde

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).