Skip to content

Commit fbb8993

Browse files
brooniedtor
authored andcommitted
Input: adxl34x-i2c - 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-i2c. 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 76e2c68 commit fbb8993

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/i2c.h>
1212
#include <linux/module.h>
1313
#include <linux/types.h>
14+
#include <linux/pm.h>
1415
#include "adxl34x.h"
1516

1617
static int adxl34x_smbus_read(struct device *dev, unsigned char reg)
@@ -105,28 +106,30 @@ static int __devexit adxl34x_i2c_remove(struct i2c_client *client)
105106
}
106107

107108
#ifdef CONFIG_PM
108-
static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message)
109+
static int adxl34x_i2c_suspend(struct device *dev)
109110
{
111+
struct i2c_client *client = to_i2c_client(dev);
110112
struct adxl34x *ac = i2c_get_clientdata(client);
111113

112114
adxl34x_suspend(ac);
113115

114116
return 0;
115117
}
116118

117-
static int adxl34x_i2c_resume(struct i2c_client *client)
119+
static int adxl34x_i2c_resume(struct device *dev)
118120
{
121+
struct i2c_client *client = to_i2c_client(dev);
119122
struct adxl34x *ac = i2c_get_clientdata(client);
120123

121124
adxl34x_resume(ac);
122125

123126
return 0;
124127
}
125-
#else
126-
# define adxl34x_i2c_suspend NULL
127-
# define adxl34x_i2c_resume NULL
128128
#endif
129129

130+
static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend,
131+
adxl34x_i2c_resume);
132+
130133
static const struct i2c_device_id adxl34x_id[] = {
131134
{ "adxl34x", 0 },
132135
{ }
@@ -138,11 +141,10 @@ static struct i2c_driver adxl34x_driver = {
138141
.driver = {
139142
.name = "adxl34x",
140143
.owner = THIS_MODULE,
144+
.pm = &adxl34x_i2c_pm,
141145
},
142146
.probe = adxl34x_i2c_probe,
143147
.remove = __devexit_p(adxl34x_i2c_remove),
144-
.suspend = adxl34x_i2c_suspend,
145-
.resume = adxl34x_i2c_resume,
146148
.id_table = adxl34x_id,
147149
};
148150

0 commit comments

Comments
 (0)