forked from Minki/linux
linux-can-fixes-for-3.19-20150127
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJUx0SsAAoJECte4hHFiupUy9wP/3YkYTtcFcyZ4xbv3v8q+AZX GklmuK8aSmyy6Rwq/ZWtE8g9FCnedBy5D5ws76BgJjwmuAinsfjA893IYfPD0oTV sR6QKkA9QP3CgAwLfkH4+Zkd/dV4ltwZwTenwTPUXLZ/6qxfWjwvGwgXPoaZtChO R3Sqf0l4h7hmVu2/xuUNAycSysQYqCkbHVD3q1bEyd6H3jvFze/YixRqOaiCXwNh nI0H7lrdAAnYKfmWfKI6SaWtfxfyejExdMfDGwbe6FWPX6YNWI/4RB+vJwVLELuy kjJBZEFEVJWNsrwXOU/EqIyajXrSIt6asLy0wNaME99QzSAyV857PY8ZLuhEwcWP bmYrIPRvFKnG+STcIhZC+xOGEPVTe2Mh4y+JLgTQ0JWFR8+8GWdBRI1Oj1BYblGh CUMIeSs1KeQ0HHBAD/frCg2FxPzE/cZvqgznr8neC6o7fkrw0HOq9zn8ovC1vsYk lky0tNDO3ZTdagghGzr1Wfcs+TAyI4qrMWTI7cbuyZ+o/icPhR3WIkA3RFR0imBb yEB32HUN06YZnvQs8DsRIh4EhJe2f/ZjSETl5uxhI/bgaBYGzplSP0S95Q8tblWR 6zpJyBTEkoaFZXLD0MPmAi7rp3EcpK3orjI5g9CgOoYK09AvIPcH3wRffvkht1/E WgmUt4gecjxWfukFU408 =S/gP -----END PGP SIGNATURE----- Merge tag 'linux-can-fixes-for-3.19-20150127' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can Marc Kleine-Budde says: ==================== pull-request: can 2015-01-27 this is another pull request for net/master which consists of 4 patches. All 4 patches are contributed by Ahmed S. Darwish, he fixes more problems in the kvaser_usb driver. David, please merge net/master to net-next/master, as we have more kvaser_usb patches in the queue, that target net-next. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
8d8d67f140
@ -587,7 +587,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
|
||||
usb_sndbulkpipe(dev->udev,
|
||||
dev->bulk_out->bEndpointAddress),
|
||||
buf, msg->len,
|
||||
kvaser_usb_simple_msg_callback, priv);
|
||||
kvaser_usb_simple_msg_callback, netdev);
|
||||
usb_anchor_urb(urb, &priv->tx_submitted);
|
||||
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
@ -662,11 +662,6 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
|
||||
priv = dev->nets[channel];
|
||||
stats = &priv->netdev->stats;
|
||||
|
||||
if (status & M16C_STATE_BUS_RESET) {
|
||||
kvaser_usb_unlink_tx_urbs(priv);
|
||||
return;
|
||||
}
|
||||
|
||||
skb = alloc_can_err_skb(priv->netdev, &cf);
|
||||
if (!skb) {
|
||||
stats->rx_dropped++;
|
||||
@ -677,7 +672,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
|
||||
|
||||
netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status);
|
||||
|
||||
if (status & M16C_STATE_BUS_OFF) {
|
||||
if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) {
|
||||
cf->can_id |= CAN_ERR_BUSOFF;
|
||||
|
||||
priv->can.can_stats.bus_off++;
|
||||
@ -703,9 +698,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
|
||||
}
|
||||
|
||||
new_state = CAN_STATE_ERROR_PASSIVE;
|
||||
}
|
||||
|
||||
if (status == M16C_STATE_BUS_ERROR) {
|
||||
} else if (status & M16C_STATE_BUS_ERROR) {
|
||||
if ((priv->can.state < CAN_STATE_ERROR_WARNING) &&
|
||||
((txerr >= 96) || (rxerr >= 96))) {
|
||||
cf->can_id |= CAN_ERR_CRTL;
|
||||
@ -715,7 +708,8 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
|
||||
|
||||
priv->can.can_stats.error_warning++;
|
||||
new_state = CAN_STATE_ERROR_WARNING;
|
||||
} else if (priv->can.state > CAN_STATE_ERROR_ACTIVE) {
|
||||
} else if ((priv->can.state > CAN_STATE_ERROR_ACTIVE) &&
|
||||
((txerr < 96) && (rxerr < 96))) {
|
||||
cf->can_id |= CAN_ERR_PROT;
|
||||
cf->data[2] = CAN_ERR_PROT_ACTIVE;
|
||||
|
||||
@ -1590,7 +1584,7 @@ static int kvaser_usb_probe(struct usb_interface *intf,
|
||||
{
|
||||
struct kvaser_usb *dev;
|
||||
int err = -ENOMEM;
|
||||
int i;
|
||||
int i, retry = 3;
|
||||
|
||||
dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev)
|
||||
@ -1608,7 +1602,15 @@ static int kvaser_usb_probe(struct usb_interface *intf,
|
||||
|
||||
usb_set_intfdata(intf, dev);
|
||||
|
||||
err = kvaser_usb_get_software_info(dev);
|
||||
/* On some x86 laptops, plugging a Kvaser device again after
|
||||
* an unplug makes the firmware always ignore the very first
|
||||
* command. For such a case, provide some room for retries
|
||||
* instead of completely exiting the driver.
|
||||
*/
|
||||
do {
|
||||
err = kvaser_usb_get_software_info(dev);
|
||||
} while (--retry && err == -ETIMEDOUT);
|
||||
|
||||
if (err) {
|
||||
dev_err(&intf->dev,
|
||||
"Cannot get software infos, error %d\n", err);
|
||||
|
Loading…
Reference in New Issue
Block a user