aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can/dev.c')
-rw-r--r--drivers/net/can/dev.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 574daddc21bf..9e4283aff828 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -346,7 +346,7 @@ void can_restart(unsigned long data)
346 skb = dev_alloc_skb(sizeof(struct can_frame)); 346 skb = dev_alloc_skb(sizeof(struct can_frame));
347 if (skb == NULL) { 347 if (skb == NULL) {
348 err = -ENOMEM; 348 err = -ENOMEM;
349 goto out; 349 goto restart;
350 } 350 }
351 skb->dev = dev; 351 skb->dev = dev;
352 skb->protocol = htons(ETH_P_CAN); 352 skb->protocol = htons(ETH_P_CAN);
@@ -361,13 +361,13 @@ void can_restart(unsigned long data)
361 stats->rx_packets++; 361 stats->rx_packets++;
362 stats->rx_bytes += cf->can_dlc; 362 stats->rx_bytes += cf->can_dlc;
363 363
364restart:
364 dev_dbg(dev->dev.parent, "restarted\n"); 365 dev_dbg(dev->dev.parent, "restarted\n");
365 priv->can_stats.restarts++; 366 priv->can_stats.restarts++;
366 367
367 /* Now restart the device */ 368 /* Now restart the device */
368 err = priv->do_set_mode(dev, CAN_MODE_START); 369 err = priv->do_set_mode(dev, CAN_MODE_START);
369 370
370out:
371 netif_carrier_on(dev); 371 netif_carrier_on(dev);
372 if (err) 372 if (err)
373 dev_err(dev->dev.parent, "Error %d during restart", err); 373 dev_err(dev->dev.parent, "Error %d during restart", err);
@@ -473,6 +473,10 @@ int open_candev(struct net_device *dev)
473 return -EINVAL; 473 return -EINVAL;
474 } 474 }
475 475
476 /* Switch carrier on if device was stopped while in bus-off state */
477 if (!netif_carrier_ok(dev))
478 netif_carrier_on(dev);
479
476 setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev); 480 setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);
477 481
478 return 0; 482 return 0;