Commit 612b2a97 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Marc Kleine-Budde

can: mcp251x: Use dev_pm_ops

Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 01b88070
...@@ -1138,9 +1138,11 @@ static int mcp251x_can_remove(struct spi_device *spi) ...@@ -1138,9 +1138,11 @@ static int mcp251x_can_remove(struct spi_device *spi)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int mcp251x_can_suspend(struct spi_device *spi, pm_message_t state)
static int mcp251x_can_suspend(struct device *dev)
{ {
struct spi_device *spi = to_spi_device(dev);
struct mcp251x_platform_data *pdata = spi->dev.platform_data; struct mcp251x_platform_data *pdata = spi->dev.platform_data;
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
struct net_device *net = priv->net; struct net_device *net = priv->net;
...@@ -1170,8 +1172,9 @@ static int mcp251x_can_suspend(struct spi_device *spi, pm_message_t state) ...@@ -1170,8 +1172,9 @@ static int mcp251x_can_suspend(struct spi_device *spi, pm_message_t state)
return 0; return 0;
} }
static int mcp251x_can_resume(struct spi_device *spi) static int mcp251x_can_resume(struct device *dev)
{ {
struct spi_device *spi = to_spi_device(dev);
struct mcp251x_platform_data *pdata = spi->dev.platform_data; struct mcp251x_platform_data *pdata = spi->dev.platform_data;
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
...@@ -1191,9 +1194,13 @@ static int mcp251x_can_resume(struct spi_device *spi) ...@@ -1191,9 +1194,13 @@ static int mcp251x_can_resume(struct spi_device *spi)
enable_irq(spi->irq); enable_irq(spi->irq);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend,
mcp251x_can_resume);
#define MCP251X_PM_OPS (&mcp251x_can_pm_ops)
#else #else
#define mcp251x_can_suspend NULL #define MCP251X_PM_OPS NULL
#define mcp251x_can_resume NULL
#endif #endif
static const struct spi_device_id mcp251x_id_table[] = { static const struct spi_device_id mcp251x_id_table[] = {
...@@ -1208,13 +1215,12 @@ static struct spi_driver mcp251x_can_driver = { ...@@ -1208,13 +1215,12 @@ static struct spi_driver mcp251x_can_driver = {
.driver = { .driver = {
.name = DEVICE_NAME, .name = DEVICE_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = MCP251X_PM_OPS,
}, },
.id_table = mcp251x_id_table, .id_table = mcp251x_id_table,
.probe = mcp251x_can_probe, .probe = mcp251x_can_probe,
.remove = mcp251x_can_remove, .remove = mcp251x_can_remove,
.suspend = mcp251x_can_suspend,
.resume = mcp251x_can_resume,
}; };
module_spi_driver(mcp251x_can_driver); module_spi_driver(mcp251x_can_driver);
......
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