Skip to content

Commit 612b2a9

Browse files
larsclausenmarckleinebudde
authored andcommitted
can: mcp251x: Use dev_pm_ops
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks. Signed-off-by: Lars-Peter Clausen <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 01b8807 commit 612b2a9

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

drivers/net/can/mcp251x.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,9 +1138,11 @@ static int mcp251x_can_remove(struct spi_device *spi)
11381138
return 0;
11391139
}
11401140

1141-
#ifdef CONFIG_PM
1142-
static int mcp251x_can_suspend(struct spi_device *spi, pm_message_t state)
1141+
#ifdef CONFIG_PM_SLEEP
1142+
1143+
static int mcp251x_can_suspend(struct device *dev)
11431144
{
1145+
struct spi_device *spi = to_spi_device(dev);
11441146
struct mcp251x_platform_data *pdata = spi->dev.platform_data;
11451147
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
11461148
struct net_device *net = priv->net;
@@ -1170,8 +1172,9 @@ static int mcp251x_can_suspend(struct spi_device *spi, pm_message_t state)
11701172
return 0;
11711173
}
11721174

1173-
static int mcp251x_can_resume(struct spi_device *spi)
1175+
static int mcp251x_can_resume(struct device *dev)
11741176
{
1177+
struct spi_device *spi = to_spi_device(dev);
11751178
struct mcp251x_platform_data *pdata = spi->dev.platform_data;
11761179
struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
11771180

@@ -1191,9 +1194,13 @@ static int mcp251x_can_resume(struct spi_device *spi)
11911194
enable_irq(spi->irq);
11921195
return 0;
11931196
}
1197+
1198+
static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend,
1199+
mcp251x_can_resume);
1200+
#define MCP251X_PM_OPS (&mcp251x_can_pm_ops)
1201+
11941202
#else
1195-
#define mcp251x_can_suspend NULL
1196-
#define mcp251x_can_resume NULL
1203+
#define MCP251X_PM_OPS NULL
11971204
#endif
11981205

11991206
static const struct spi_device_id mcp251x_id_table[] = {
@@ -1208,13 +1215,12 @@ static struct spi_driver mcp251x_can_driver = {
12081215
.driver = {
12091216
.name = DEVICE_NAME,
12101217
.owner = THIS_MODULE,
1218+
.pm = MCP251X_PM_OPS,
12111219
},
12121220

12131221
.id_table = mcp251x_id_table,
12141222
.probe = mcp251x_can_probe,
12151223
.remove = mcp251x_can_remove,
1216-
.suspend = mcp251x_can_suspend,
1217-
.resume = mcp251x_can_resume,
12181224
};
12191225
module_spi_driver(mcp251x_can_driver);
12201226

0 commit comments

Comments
 (0)