aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-22 19:34:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-22 20:44:16 -0400
commitbc96ba7414ca4456661d0873856e0f363d32ba67 (patch)
treeccfc298a25cf4c649f43acde645c98751581c15c /drivers/rtc
parentea611b2699b51a762ef03f805f9616e65d98f68e (diff)
rtc: convert DS1374 to dev_pm_ops
There is a general move to replace bus-specific PM ops with dev_pm_ops in order to facilitate core improvements. Do this conversion for DS1374. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: john stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-ds1374.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index d834a63ec4b0..e6e71deb188f 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -25,6 +25,7 @@
25#include <linux/bcd.h> 25#include <linux/bcd.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/pm.h>
28 29
29#define DS1374_REG_TOD0 0x00 /* Time of Day */ 30#define DS1374_REG_TOD0 0x00 /* Time of Day */
30#define DS1374_REG_TOD1 0x01 31#define DS1374_REG_TOD1 0x01
@@ -409,32 +410,38 @@ static int __devexit ds1374_remove(struct i2c_client *client)
409} 410}
410 411
411#ifdef CONFIG_PM 412#ifdef CONFIG_PM
412static int ds1374_suspend(struct i2c_client *client, pm_message_t state) 413static int ds1374_suspend(struct device *dev)
413{ 414{
415 struct i2c_client *client = to_i2c_client(dev);
416
414 if (client->irq >= 0 && device_may_wakeup(&client->dev)) 417 if (client->irq >= 0 && device_may_wakeup(&client->dev))
415 enable_irq_wake(client->irq); 418 enable_irq_wake(client->irq);
416 return 0; 419 return 0;
417} 420}
418 421
419static int ds1374_resume(struct i2c_client *client) 422static int ds1374_resume(struct device *dev)
420{ 423{
424 struct i2c_client *client = to_i2c_client(dev);
425
421 if (client->irq >= 0 && device_may_wakeup(&client->dev)) 426 if (client->irq >= 0 && device_may_wakeup(&client->dev))
422 disable_irq_wake(client->irq); 427 disable_irq_wake(client->irq);
423 return 0; 428 return 0;
424} 429}
430
431static SIMPLE_DEV_PM_OPS(ds1374_pm, ds1374_suspend, ds1374_resume);
432
433#define DS1374_PM (&ds1374_pm)
425#else 434#else
426#define ds1374_suspend NULL 435#define DS1374_PM NULL
427#define ds1374_resume NULL
428#endif 436#endif
429 437
430static struct i2c_driver ds1374_driver = { 438static struct i2c_driver ds1374_driver = {
431 .driver = { 439 .driver = {
432 .name = "rtc-ds1374", 440 .name = "rtc-ds1374",
433 .owner = THIS_MODULE, 441 .owner = THIS_MODULE,
442 .pm = DS1374_PM,
434 }, 443 },
435 .probe = ds1374_probe, 444 .probe = ds1374_probe,
436 .suspend = ds1374_suspend,
437 .resume = ds1374_resume,
438 .remove = __devexit_p(ds1374_remove), 445 .remove = __devexit_p(ds1374_remove),
439 .id_table = ds1374_id, 446 .id_table = ds1374_id,
440}; 447};