Skip to content

Commit

Permalink
Merge branch 'fixes-for-3.12' of git://gitorious.org/linux-can/linux-can
Browse files Browse the repository at this point in the history
Marc Kleine-Budde says:

====================
I have two late fixes for the v3.12 release:

The first patch fixes a problem in the c_can's RX message handling, which can
lead to an endless interrupt loop under heavy load if messages are lost. The
second patch is by Olivier Sobrie and fixes the endpoint detection of the
kvaser_usb driver, which is needed for some devices.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Nov 4, 2013
2 parents 7926c1d + 896e23b commit e9b51a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
6 changes: 3 additions & 3 deletions drivers/net/can/c_can/c_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,16 +814,16 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
msg_ctrl_save = priv->read_reg(priv,
C_CAN_IFACE(MSGCTRL_REG, 0));

if (msg_ctrl_save & IF_MCONT_EOB)
return num_rx_pkts;

if (msg_ctrl_save & IF_MCONT_MSGLST) {
c_can_handle_lost_msg_obj(dev, 0, msg_obj);
num_rx_pkts++;
quota--;
continue;
}

if (msg_ctrl_save & IF_MCONT_EOB)
return num_rx_pkts;

if (!(msg_ctrl_save & IF_MCONT_NEWDAT))
continue;

Expand Down
20 changes: 13 additions & 7 deletions drivers/net/can/usb/kvaser_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,9 +1544,9 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
return 0;
}

static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
struct usb_endpoint_descriptor **in,
struct usb_endpoint_descriptor **out)
static int kvaser_usb_get_endpoints(const struct usb_interface *intf,
struct usb_endpoint_descriptor **in,
struct usb_endpoint_descriptor **out)
{
const struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
Expand All @@ -1557,12 +1557,18 @@ 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;

/* use first bulk endpoint for in and out */
if (*in && *out)
return 0;
}

return -ENODEV;
}

static int kvaser_usb_probe(struct usb_interface *intf,
Expand All @@ -1576,8 +1582,8 @@ static int kvaser_usb_probe(struct usb_interface *intf,
if (!dev)
return -ENOMEM;

kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
if (!dev->bulk_in || !dev->bulk_out) {
err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
if (err) {
dev_err(&intf->dev, "Cannot get usb endpoint(s)");
return err;
}
Expand Down

0 comments on commit e9b51a1

Please sign in to comment.