diff options
Diffstat (limited to 'drivers/input/misc/adxl34x-i2c.c')
-rw-r--r-- | drivers/input/misc/adxl34x-i2c.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c index 0779724af7e7..ccacf2bb06a4 100644 --- a/drivers/input/misc/adxl34x-i2c.c +++ b/drivers/input/misc/adxl34x-i2c.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/i2c.h> | 11 | #include <linux/i2c.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/pm.h> | ||
14 | #include "adxl34x.h" | 15 | #include "adxl34x.h" |
15 | 16 | ||
16 | static int adxl34x_smbus_read(struct device *dev, unsigned char reg) | 17 | static int adxl34x_smbus_read(struct device *dev, unsigned char reg) |
@@ -105,8 +106,9 @@ static int __devexit adxl34x_i2c_remove(struct i2c_client *client) | |||
105 | } | 106 | } |
106 | 107 | ||
107 | #ifdef CONFIG_PM | 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 | struct adxl34x *ac = i2c_get_clientdata(client); | 112 | struct adxl34x *ac = i2c_get_clientdata(client); |
111 | 113 | ||
112 | adxl34x_suspend(ac); | 114 | adxl34x_suspend(ac); |
@@ -114,19 +116,20 @@ static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message) | |||
114 | return 0; | 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 | struct adxl34x *ac = i2c_get_clientdata(client); | 122 | struct adxl34x *ac = i2c_get_clientdata(client); |
120 | 123 | ||
121 | adxl34x_resume(ac); | 124 | adxl34x_resume(ac); |
122 | 125 | ||
123 | return 0; | 126 | return 0; |
124 | } | 127 | } |
125 | #else | ||
126 | # define adxl34x_i2c_suspend NULL | ||
127 | # define adxl34x_i2c_resume NULL | ||
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend, | ||
131 | adxl34x_i2c_resume); | ||
132 | |||
130 | static const struct i2c_device_id adxl34x_id[] = { | 133 | static const struct i2c_device_id adxl34x_id[] = { |
131 | { "adxl34x", 0 }, | 134 | { "adxl34x", 0 }, |
132 | { } | 135 | { } |
@@ -138,11 +141,10 @@ static struct i2c_driver adxl34x_driver = { | |||
138 | .driver = { | 141 | .driver = { |
139 | .name = "adxl34x", | 142 | .name = "adxl34x", |
140 | .owner = THIS_MODULE, | 143 | .owner = THIS_MODULE, |
144 | .pm = &adxl34x_i2c_pm, | ||
141 | }, | 145 | }, |
142 | .probe = adxl34x_i2c_probe, | 146 | .probe = adxl34x_i2c_probe, |
143 | .remove = __devexit_p(adxl34x_i2c_remove), | 147 | .remove = __devexit_p(adxl34x_i2c_remove), |
144 | .suspend = adxl34x_i2c_suspend, | ||
145 | .resume = adxl34x_i2c_resume, | ||
146 | .id_table = adxl34x_id, | 148 | .id_table = adxl34x_id, |
147 | }; | 149 | }; |
148 | 150 | ||