diff options
-rw-r--r-- | drivers/net/can/c_can/c_can.c | 6 | ||||
-rw-r--r-- | drivers/net/can/usb/kvaser_usb.c | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index a668cd491cb3..e3fc07cf2f62 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
@@ -814,9 +814,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota) | |||
814 | msg_ctrl_save = priv->read_reg(priv, | 814 | msg_ctrl_save = priv->read_reg(priv, |
815 | C_CAN_IFACE(MSGCTRL_REG, 0)); | 815 | C_CAN_IFACE(MSGCTRL_REG, 0)); |
816 | 816 | ||
817 | if (msg_ctrl_save & IF_MCONT_EOB) | ||
818 | return num_rx_pkts; | ||
819 | |||
820 | if (msg_ctrl_save & IF_MCONT_MSGLST) { | 817 | if (msg_ctrl_save & IF_MCONT_MSGLST) { |
821 | c_can_handle_lost_msg_obj(dev, 0, msg_obj); | 818 | c_can_handle_lost_msg_obj(dev, 0, msg_obj); |
822 | num_rx_pkts++; | 819 | num_rx_pkts++; |
@@ -824,6 +821,9 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota) | |||
824 | continue; | 821 | continue; |
825 | } | 822 | } |
826 | 823 | ||
824 | if (msg_ctrl_save & IF_MCONT_EOB) | ||
825 | return num_rx_pkts; | ||
826 | |||
827 | if (!(msg_ctrl_save & IF_MCONT_NEWDAT)) | 827 | if (!(msg_ctrl_save & IF_MCONT_NEWDAT)) |
828 | continue; | 828 | continue; |
829 | 829 | ||
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 3b9546588240..4b2d5ed62b11 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -1544,9 +1544,9 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
1544 | return 0; | 1544 | return 0; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | static void kvaser_usb_get_endpoints(const struct usb_interface *intf, | 1547 | static int kvaser_usb_get_endpoints(const struct usb_interface *intf, |
1548 | struct usb_endpoint_descriptor **in, | 1548 | struct usb_endpoint_descriptor **in, |
1549 | struct usb_endpoint_descriptor **out) | 1549 | struct usb_endpoint_descriptor **out) |
1550 | { | 1550 | { |
1551 | const struct usb_host_interface *iface_desc; | 1551 | const struct usb_host_interface *iface_desc; |
1552 | struct usb_endpoint_descriptor *endpoint; | 1552 | struct usb_endpoint_descriptor *endpoint; |
@@ -1557,12 +1557,18 @@ static void kvaser_usb_get_endpoints(const struct usb_interface *intf, | |||
1557 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 1557 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
1558 | endpoint = &iface_desc->endpoint[i].desc; | 1558 | endpoint = &iface_desc->endpoint[i].desc; |
1559 | 1559 | ||
1560 | if (usb_endpoint_is_bulk_in(endpoint)) | 1560 | if (!*in && usb_endpoint_is_bulk_in(endpoint)) |
1561 | *in = endpoint; | 1561 | *in = endpoint; |
1562 | 1562 | ||
1563 | if (usb_endpoint_is_bulk_out(endpoint)) | 1563 | if (!*out && usb_endpoint_is_bulk_out(endpoint)) |
1564 | *out = endpoint; | 1564 | *out = endpoint; |
1565 | |||
1566 | /* use first bulk endpoint for in and out */ | ||
1567 | if (*in && *out) | ||
1568 | return 0; | ||
1565 | } | 1569 | } |
1570 | |||
1571 | return -ENODEV; | ||
1566 | } | 1572 | } |
1567 | 1573 | ||
1568 | static int kvaser_usb_probe(struct usb_interface *intf, | 1574 | static int kvaser_usb_probe(struct usb_interface *intf, |
@@ -1576,8 +1582,8 @@ static int kvaser_usb_probe(struct usb_interface *intf, | |||
1576 | if (!dev) | 1582 | if (!dev) |
1577 | return -ENOMEM; | 1583 | return -ENOMEM; |
1578 | 1584 | ||
1579 | kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); | 1585 | err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); |
1580 | if (!dev->bulk_in || !dev->bulk_out) { | 1586 | if (err) { |
1581 | dev_err(&intf->dev, "Cannot get usb endpoint(s)"); | 1587 | dev_err(&intf->dev, "Cannot get usb endpoint(s)"); |
1582 | return err; | 1588 | return err; |
1583 | } | 1589 | } |