can: switch carrier on if device was stopped while in bus-off state
authorWolfgang Grandegger <wg@grandegger.com>
Mon, 20 Jul 2009 04:06:41 +0000 (04:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Jul 2009 19:28:30 +0000 (12:28 -0700)
This patch fixes a problem when a device is stopped while in the
bus-off state. Then the carrier remains off forever.

Signed-off-by: Kurt Van Dijck <kurt.van.dijck@skynet.be>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/can/dev.c

index 06083c32869a14b0c18aece6a88d3dbeb43f6db3..9e4283aff828d9adc1f03db2276b38add2b9a31d 100644 (file)
@@ -473,6 +473,10 @@ int open_candev(struct net_device *dev)
                return -EINVAL;
        }
 
+       /* Switch carrier on if device was stopped while in bus-off state */
+       if (!netif_carrier_ok(dev))
+               netif_carrier_on(dev);
+
        setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);
 
        return 0;