Commit 588e7a8e authored by Fabio Estevam's avatar Fabio Estevam Committed by Marc Kleine-Budde

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: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 4d7f7635
...@@ -1131,10 +1131,10 @@ static int flexcan_remove(struct platform_device *pdev) ...@@ -1131,10 +1131,10 @@ static int flexcan_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) static int flexcan_suspend(struct device *device)
{ {
struct net_device *dev = platform_get_drvdata(pdev); struct net_device *dev = dev_get_drvdata(device);
struct flexcan_priv *priv = netdev_priv(dev); struct flexcan_priv *priv = netdev_priv(dev);
flexcan_chip_disable(priv); flexcan_chip_disable(priv);
...@@ -1148,9 +1148,9 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -1148,9 +1148,9 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int flexcan_resume(struct platform_device *pdev) static int flexcan_resume(struct device *device)
{ {
struct net_device *dev = platform_get_drvdata(pdev); struct net_device *dev = dev_get_drvdata(device);
struct flexcan_priv *priv = netdev_priv(dev); struct flexcan_priv *priv = netdev_priv(dev);
priv->can.state = CAN_STATE_ERROR_ACTIVE; priv->can.state = CAN_STATE_ERROR_ACTIVE;
...@@ -1162,21 +1162,19 @@ static int flexcan_resume(struct platform_device *pdev) ...@@ -1162,21 +1162,19 @@ static int flexcan_resume(struct platform_device *pdev)
return 0; return 0;
} }
#else #endif /* CONFIG_PM_SLEEP */
#define flexcan_suspend NULL
#define flexcan_resume NULL static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume);
#endif
static struct platform_driver flexcan_driver = { static struct platform_driver flexcan_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &flexcan_pm_ops,
.of_match_table = flexcan_of_match, .of_match_table = flexcan_of_match,
}, },
.probe = flexcan_probe, .probe = flexcan_probe,
.remove = flexcan_remove, .remove = flexcan_remove,
.suspend = flexcan_suspend,
.resume = flexcan_resume,
.id_table = flexcan_id_table, .id_table = flexcan_id_table,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment