diff options
author | Shubhrajyoti Datta <shubhrajyoti@ti.com> | 2011-03-22 19:33:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:10 -0400 |
commit | 4a7de634f0316080cae5dd4a994112049a7d8462 (patch) | |
tree | 15b12ff69791706839d1f4a3353379ef9e43feca /drivers/misc | |
parent | f3ccfcdaf3986f8c541886606e950de52cab7ad3 (diff) |
bh1780gli: convert to dev pm ops
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/bh1780gli.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c index d5f3a3fd2319..d07cd67c951c 100644 --- a/drivers/misc/bh1780gli.c +++ b/drivers/misc/bh1780gli.c | |||
@@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | #ifdef CONFIG_PM | 198 | #ifdef CONFIG_PM |
199 | static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg) | 199 | static int bh1780_suspend(struct device *dev) |
200 | { | 200 | { |
201 | struct bh1780_data *ddata; | 201 | struct bh1780_data *ddata; |
202 | int state, ret; | 202 | int state, ret; |
203 | struct i2c_client *client = to_i2c_client(dev); | ||
203 | 204 | ||
204 | ddata = i2c_get_clientdata(client); | 205 | ddata = i2c_get_clientdata(client); |
205 | state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); | 206 | state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); |
@@ -217,14 +218,14 @@ static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg) | |||
217 | return 0; | 218 | return 0; |
218 | } | 219 | } |
219 | 220 | ||
220 | static int bh1780_resume(struct i2c_client *client) | 221 | static int bh1780_resume(struct device *dev) |
221 | { | 222 | { |
222 | struct bh1780_data *ddata; | 223 | struct bh1780_data *ddata; |
223 | int state, ret; | 224 | int state, ret; |
225 | struct i2c_client *client = to_i2c_client(dev); | ||
224 | 226 | ||
225 | ddata = i2c_get_clientdata(client); | 227 | ddata = i2c_get_clientdata(client); |
226 | state = ddata->power_state; | 228 | state = ddata->power_state; |
227 | |||
228 | ret = bh1780_write(ddata, BH1780_REG_CONTROL, state, | 229 | ret = bh1780_write(ddata, BH1780_REG_CONTROL, state, |
229 | "CONTROL"); | 230 | "CONTROL"); |
230 | 231 | ||
@@ -233,9 +234,10 @@ static int bh1780_resume(struct i2c_client *client) | |||
233 | 234 | ||
234 | return 0; | 235 | return 0; |
235 | } | 236 | } |
237 | static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume); | ||
238 | #define BH1780_PMOPS (&bh1780_pm) | ||
236 | #else | 239 | #else |
237 | #define bh1780_suspend NULL | 240 | #define BH1780_PMOPS NULL |
238 | #define bh1780_resume NULL | ||
239 | #endif /* CONFIG_PM */ | 241 | #endif /* CONFIG_PM */ |
240 | 242 | ||
241 | static const struct i2c_device_id bh1780_id[] = { | 243 | static const struct i2c_device_id bh1780_id[] = { |
@@ -247,11 +249,10 @@ static struct i2c_driver bh1780_driver = { | |||
247 | .probe = bh1780_probe, | 249 | .probe = bh1780_probe, |
248 | .remove = bh1780_remove, | 250 | .remove = bh1780_remove, |
249 | .id_table = bh1780_id, | 251 | .id_table = bh1780_id, |
250 | .suspend = bh1780_suspend, | ||
251 | .resume = bh1780_resume, | ||
252 | .driver = { | 252 | .driver = { |
253 | .name = "bh1780" | 253 | .name = "bh1780", |
254 | }, | 254 | .pm = BH1780_PMOPS, |
255 | }, | ||
255 | }; | 256 | }; |
256 | 257 | ||
257 | static int __init bh1780_init(void) | 258 | static int __init bh1780_init(void) |