diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-06 14:13:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-06 14:13:26 -0400 |
commit | 9b97b84eb51e689b90960916e7c2f57f4790f17f (patch) | |
tree | ae3687f027abf0d670ba533459fa48f61c62cf7a /drivers/net/can | |
parent | d7ce8a5f63838d99726ec81f666075d65361325b (diff) | |
parent | d6e640f9766e2fb9aa3853b4ff19e4d7d5d7e373 (diff) |
Merge branch 'master' of git://gitorious.org/linux-can/linux-can-next
Diffstat (limited to 'drivers/net/can')
-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[] = { | |||
1056 | {}, | 1056 | {}, |
1057 | }; | 1057 | }; |
1058 | 1058 | ||
1059 | #ifdef CONFIG_PM | ||
1060 | static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) | ||
1061 | { | ||
1062 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1063 | struct flexcan_priv *priv = netdev_priv(dev); | ||
1064 | |||
1065 | flexcan_chip_disable(priv); | ||
1066 | |||
1067 | if (netif_running(dev)) { | ||
1068 | netif_stop_queue(dev); | ||
1069 | netif_device_detach(dev); | ||
1070 | } | ||
1071 | priv->can.state = CAN_STATE_SLEEPING; | ||
1072 | |||
1073 | return 0; | ||
1074 | } | ||
1075 | |||
1076 | static int flexcan_resume(struct platform_device *pdev) | ||
1077 | { | ||
1078 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1079 | struct flexcan_priv *priv = netdev_priv(dev); | ||
1080 | |||
1081 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | ||
1082 | if (netif_running(dev)) { | ||
1083 | netif_device_attach(dev); | ||
1084 | netif_start_queue(dev); | ||
1085 | } | ||
1086 | flexcan_chip_enable(priv); | ||
1087 | |||
1088 | return 0; | ||
1089 | } | ||
1090 | #else | ||
1091 | #define flexcan_suspend NULL | ||
1092 | #define flexcan_resume NULL | ||
1093 | #endif | ||
1094 | |||
1059 | static struct platform_driver flexcan_driver = { | 1095 | static struct platform_driver flexcan_driver = { |
1060 | .driver = { | 1096 | .driver = { |
1061 | .name = DRV_NAME, | 1097 | .name = DRV_NAME, |
@@ -1064,6 +1100,8 @@ static struct platform_driver flexcan_driver = { | |||
1064 | }, | 1100 | }, |
1065 | .probe = flexcan_probe, | 1101 | .probe = flexcan_probe, |
1066 | .remove = __devexit_p(flexcan_remove), | 1102 | .remove = __devexit_p(flexcan_remove), |
1103 | .suspend = flexcan_suspend, | ||
1104 | .resume = flexcan_resume, | ||
1067 | }; | 1105 | }; |
1068 | 1106 | ||
1069 | module_platform_driver(flexcan_driver); | 1107 | module_platform_driver(flexcan_driver); |