Commit fbb899356d4a6b6080ab3d9656914938db49449e

Authored by Mark Brown
Committed by Dmitry Torokhov
1 parent 76e2c68f32

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>

Showing 1 changed file with 9 additions and 7 deletions Side-by-side Diff

drivers/input/misc/adxl34x-i2c.c
... ... @@ -11,6 +11,7 @@
11 11 #include <linux/i2c.h>
12 12 #include <linux/module.h>
13 13 #include <linux/types.h>
  14 +#include <linux/pm.h>
14 15 #include "adxl34x.h"
15 16  
16 17 static int adxl34x_smbus_read(struct device *dev, unsigned char reg)
17 18  
... ... @@ -105,8 +106,9 @@
105 106 }
106 107  
107 108 #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)
109 110 {
  111 + struct i2c_client *client = to_i2c_client(dev);
110 112 struct adxl34x *ac = i2c_get_clientdata(client);
111 113  
112 114 adxl34x_suspend(ac);
113 115  
114 116  
115 117  
... ... @@ -114,19 +116,20 @@
114 116 return 0;
115 117 }
116 118  
117   -static int adxl34x_i2c_resume(struct i2c_client *client)
  119 +static int adxl34x_i2c_resume(struct device *dev)
118 120 {
  121 + struct i2c_client *client = to_i2c_client(dev);
119 122 struct adxl34x *ac = i2c_get_clientdata(client);
120 123  
121 124 adxl34x_resume(ac);
122 125  
123 126 return 0;
124 127 }
125   -#else
126   -# define adxl34x_i2c_suspend NULL
127   -# define adxl34x_i2c_resume NULL
128 128 #endif
129 129  
  130 +static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend,
  131 + adxl34x_i2c_resume);
  132 +
130 133 static const struct i2c_device_id adxl34x_id[] = {
131 134 { "adxl34x", 0 },
132 135 { }
133 136  
... ... @@ -138,11 +141,10 @@
138 141 .driver = {
139 142 .name = "adxl34x",
140 143 .owner = THIS_MODULE,
  144 + .pm = &adxl34x_i2c_pm,
141 145 },
142 146 .probe = adxl34x_i2c_probe,
143 147 .remove = __devexit_p(adxl34x_i2c_remove),
144   - .suspend = adxl34x_i2c_suspend,
145   - .resume = adxl34x_i2c_resume,
146 148 .id_table = adxl34x_id,
147 149 };
148 150