diff options
Diffstat (limited to 'drivers/net/can/flexcan.c')
-rw-r--r-- | drivers/net/can/flexcan.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 1d1c224c8854..920b8a01f9cb 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1091,15 +1091,16 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) if (netif_running(dev)) { netif_stop_queue(dev); netif_device_detach(dev); - } - priv->can.state = CAN_STATE_SLEEPING; + /* enter stop mode if device is up */ + flexcan_enter_stop(priv); - flexcan_enter_stop(priv); + ret = irq_set_irq_wake(dev->irq, 1); + if (ret) + return ret; + } - ret = irq_set_irq_wake(dev->irq, 1); - if (ret) - return ret; + priv->can.state = CAN_STATE_SLEEPING; return 0; } @@ -1110,15 +1111,15 @@ static int flexcan_resume(struct platform_device *pdev) struct flexcan_priv *priv = netdev_priv(dev); int ret; - ret = irq_set_irq_wake(dev->irq, 0); - if (ret) - return ret; - - flexcan_exit_stop(priv); - priv->can.state = CAN_STATE_ERROR_ACTIVE; if (netif_running(dev)) { + ret = irq_set_irq_wake(dev->irq, 0); + if (ret) + return ret; + + flexcan_exit_stop(priv); + netif_device_attach(dev); netif_start_queue(dev); } |