Skip to content

Commit 4d1ac94

Browse files
brooniedtor
authored andcommitted
Input: adxl34x-spi - convert to dev_pm_ops
There is a general move to convert drivers to use dev_pm_ops rather than bus specific ones in order to facilitate core development. Do this conversion for adxl34x-spi. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent fbb8993 commit 4d1ac94

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎drivers/input/misc/adxl34x-spi.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/input.h> /* BUS_SPI */
1111
#include <linux/module.h>
1212
#include <linux/spi/spi.h>
13+
#include <linux/pm.h>
1314
#include <linux/types.h>
1415
#include "adxl34x.h"
1516

@@ -94,38 +95,39 @@ static int __devexit adxl34x_spi_remove(struct spi_device *spi)
9495
}
9596

9697
#ifdef CONFIG_PM
97-
static int adxl34x_spi_suspend(struct spi_device *spi, pm_message_t message)
98+
static int adxl34x_spi_suspend(struct device *dev)
9899
{
100+
struct spi_device *spi = to_spi_device(dev);
99101
struct adxl34x *ac = dev_get_drvdata(&spi->dev);
100102

101103
adxl34x_suspend(ac);
102104

103105
return 0;
104106
}
105107

106-
static int adxl34x_spi_resume(struct spi_device *spi)
108+
static int adxl34x_spi_resume(struct device *dev)
107109
{
110+
struct spi_device *spi = to_spi_device(dev);
108111
struct adxl34x *ac = dev_get_drvdata(&spi->dev);
109112

110113
adxl34x_resume(ac);
111114

112115
return 0;
113116
}
114-
#else
115-
# define adxl34x_spi_suspend NULL
116-
# define adxl34x_spi_resume NULL
117117
#endif
118118

119+
static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend,
120+
adxl34x_spi_resume);
121+
119122
static struct spi_driver adxl34x_driver = {
120123
.driver = {
121124
.name = "adxl34x",
122125
.bus = &spi_bus_type,
123126
.owner = THIS_MODULE,
127+
.pm = &adxl34x_spi_pm,
124128
},
125129
.probe = adxl34x_spi_probe,
126130
.remove = __devexit_p(adxl34x_spi_remove),
127-
.suspend = adxl34x_spi_suspend,
128-
.resume = adxl34x_spi_resume,
129131
};
130132

131133
static int __init adxl34x_spi_init(void)

0 commit comments

Comments
 (0)