Commit d5dc9ac3f6daf7df45c49e5a861c733a5f794c6b

Authored by Mark Brown
Committed by Dmitry Torokhov
1 parent a6d38f8897

Input: ad7879 - convert I2C to dev_pm_ops

There is a general move towards the use of dev_pm_ops rather than
bus specific suspend APIs as this simplifies both the bus and PM core
implementations. Convert the ad7879-ts I2C support over.

Compile tested only.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

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

drivers/input/touchscreen/ad7879-i2c.c
... ... @@ -10,14 +10,16 @@
10 10 #include <linux/i2c.h>
11 11 #include <linux/module.h>
12 12 #include <linux/types.h>
  13 +#include <linux/pm.h>
13 14  
14 15 #include "ad7879.h"
15 16  
16 17 #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */
17 18  
18 19 #ifdef CONFIG_PM
19   -static int ad7879_i2c_suspend(struct i2c_client *client, pm_message_t message)
  20 +static int ad7879_i2c_suspend(struct device *dev)
20 21 {
  22 + struct i2c_client *client = to_i2c_client(dev);
21 23 struct ad7879 *ts = i2c_get_clientdata(client);
22 24  
23 25 ad7879_suspend(ts);
24 26  
25 27  
... ... @@ -25,17 +27,17 @@
25 27 return 0;
26 28 }
27 29  
28   -static int ad7879_i2c_resume(struct i2c_client *client)
  30 +static int ad7879_i2c_resume(struct device *dev)
29 31 {
  32 + struct i2c_client *client = to_i2c_client(dev);
30 33 struct ad7879 *ts = i2c_get_clientdata(client);
31 34  
32 35 ad7879_resume(ts);
33 36  
34 37 return 0;
35 38 }
36   -#else
37   -# define ad7879_i2c_suspend NULL
38   -# define ad7879_i2c_resume NULL
  39 +
  40 +static SIMPLE_DEV_PM_OPS(ad7879_i2c_pm, ad7879_i2c_suspend, ad7879_i2c_resume);
39 41 #endif
40 42  
41 43 /* All registers are word-sized.
42 44  
... ... @@ -117,11 +119,12 @@
117 119 .driver = {
118 120 .name = "ad7879",
119 121 .owner = THIS_MODULE,
  122 +#ifdef CONFIG_PM
  123 + .pm = &ad7879_i2c_pm,
  124 +#endif
120 125 },
121 126 .probe = ad7879_i2c_probe,
122 127 .remove = __devexit_p(ad7879_i2c_remove),
123   - .suspend = ad7879_i2c_suspend,
124   - .resume = ad7879_i2c_resume,
125 128 .id_table = ad7879_id,
126 129 };
127 130