diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-06 11:13:26 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-06 11:13:26 -0700 |
commit | 9b97b84eb51e689b90960916e7c2f57f4790f17f (patch) | |
tree | ae3687f027abf0d670ba533459fa48f61c62cf7a /drivers | |
parent | d7ce8a5f63838d99726ec81f666075d65361325b (diff) | |
parent | d6e640f9766e2fb9aa3853b4ff19e4d7d5d7e373 (diff) | |
download | blackbird-op-linux-9b97b84eb51e689b90960916e7c2f57f4790f17f.tar.gz blackbird-op-linux-9b97b84eb51e689b90960916e7c2f57f4790f17f.zip |
Merge branch 'master' of git://gitorious.org/linux-can/linux-can-next
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/can/flexcan.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 38c0690df5c8..d465fd4546f0 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1056,6 +1056,42 @@ static struct of_device_id flexcan_of_match[] = { {}, }; +#ifdef CONFIG_PM +static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct net_device *dev = platform_get_drvdata(pdev); + struct flexcan_priv *priv = netdev_priv(dev); + + flexcan_chip_disable(priv); + + if (netif_running(dev)) { + netif_stop_queue(dev); + netif_device_detach(dev); + } + priv->can.state = CAN_STATE_SLEEPING; + + return 0; +} + +static int flexcan_resume(struct platform_device *pdev) +{ + struct net_device *dev = platform_get_drvdata(pdev); + struct flexcan_priv *priv = netdev_priv(dev); + + priv->can.state = CAN_STATE_ERROR_ACTIVE; + if (netif_running(dev)) { + netif_device_attach(dev); + netif_start_queue(dev); + } + flexcan_chip_enable(priv); + + return 0; +} +#else +#define flexcan_suspend NULL +#define flexcan_resume NULL +#endif + static struct platform_driver flexcan_driver = { .driver = { .name = DRV_NAME, @@ -1064,6 +1100,8 @@ static struct platform_driver flexcan_driver = { }, .probe = flexcan_probe, .remove = __devexit_p(flexcan_remove), + .suspend = flexcan_suspend, + .resume = flexcan_resume, }; module_platform_driver(flexcan_driver); |