diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-05-20 14:43:43 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2013-06-03 07:13:49 -0400 |
commit | 588e7a8e123da07b6ffe87f156e25afc1c3d7cce (patch) | |
tree | 738d8c7e30a33f91d2d4886f5c3db65f2df265fb /drivers/net/can | |
parent | 4d7f7635f75da2924916946cb7ac49c5603b44c7 (diff) |
can: flexcan: Use SIMPLE_DEV_PM_OPS
Using SIMPLE_DEV_PM_OPS can make the code smaller and simpler.
Also change CONFIG_PM to CONFIG_PM_SLEEP.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/flexcan.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index a93cdb29fb3f..f873b9f8d4d4 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -1131,10 +1131,10 @@ static int flexcan_remove(struct platform_device *pdev) | |||
1131 | return 0; | 1131 | return 0; |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | #ifdef CONFIG_PM | 1134 | #ifdef CONFIG_PM_SLEEP |
1135 | static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) | 1135 | static int flexcan_suspend(struct device *device) |
1136 | { | 1136 | { |
1137 | struct net_device *dev = platform_get_drvdata(pdev); | 1137 | struct net_device *dev = dev_get_drvdata(device); |
1138 | struct flexcan_priv *priv = netdev_priv(dev); | 1138 | struct flexcan_priv *priv = netdev_priv(dev); |
1139 | 1139 | ||
1140 | flexcan_chip_disable(priv); | 1140 | flexcan_chip_disable(priv); |
@@ -1148,9 +1148,9 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) | |||
1148 | return 0; | 1148 | return 0; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | static int flexcan_resume(struct platform_device *pdev) | 1151 | static int flexcan_resume(struct device *device) |
1152 | { | 1152 | { |
1153 | struct net_device *dev = platform_get_drvdata(pdev); | 1153 | struct net_device *dev = dev_get_drvdata(device); |
1154 | struct flexcan_priv *priv = netdev_priv(dev); | 1154 | struct flexcan_priv *priv = netdev_priv(dev); |
1155 | 1155 | ||
1156 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 1156 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
@@ -1162,21 +1162,19 @@ static int flexcan_resume(struct platform_device *pdev) | |||
1162 | 1162 | ||
1163 | return 0; | 1163 | return 0; |
1164 | } | 1164 | } |
1165 | #else | 1165 | #endif /* CONFIG_PM_SLEEP */ |
1166 | #define flexcan_suspend NULL | 1166 | |
1167 | #define flexcan_resume NULL | 1167 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); |
1168 | #endif | ||
1169 | 1168 | ||
1170 | static struct platform_driver flexcan_driver = { | 1169 | static struct platform_driver flexcan_driver = { |
1171 | .driver = { | 1170 | .driver = { |
1172 | .name = DRV_NAME, | 1171 | .name = DRV_NAME, |
1173 | .owner = THIS_MODULE, | 1172 | .owner = THIS_MODULE, |
1173 | .pm = &flexcan_pm_ops, | ||
1174 | .of_match_table = flexcan_of_match, | 1174 | .of_match_table = flexcan_of_match, |
1175 | }, | 1175 | }, |
1176 | .probe = flexcan_probe, | 1176 | .probe = flexcan_probe, |
1177 | .remove = flexcan_remove, | 1177 | .remove = flexcan_remove, |
1178 | .suspend = flexcan_suspend, | ||
1179 | .resume = flexcan_resume, | ||
1180 | .id_table = flexcan_id_table, | 1178 | .id_table = flexcan_id_table, |
1181 | }; | 1179 | }; |
1182 | 1180 | ||