Skip to content

Commit 84b8924

Browse files
Jingoo Hansfrothwell
authored andcommitted
rtc: rtc-stmp3xxx: convert stmp3xxx_rtcdrv to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 4017f83 commit 84b8924

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/rtc/rtc-stmp3xxx.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
295295
return err;
296296
}
297297

298-
#ifdef CONFIG_PM
299-
static int stmp3xxx_rtc_suspend(struct platform_device *dev, pm_message_t state)
298+
#ifdef CONFIG_PM_SLEEP
299+
static int stmp3xxx_rtc_suspend(struct device *dev)
300300
{
301301
return 0;
302302
}
303303

304-
static int stmp3xxx_rtc_resume(struct platform_device *dev)
304+
static int stmp3xxx_rtc_resume(struct device *dev)
305305
{
306-
struct stmp3xxx_rtc_data *rtc_data = platform_get_drvdata(dev);
306+
struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
307307

308308
stmp_reset_block(rtc_data->io);
309309
writel(STMP3XXX_RTC_PERSISTENT0_ALARM_EN |
@@ -312,11 +312,11 @@ static int stmp3xxx_rtc_resume(struct platform_device *dev)
312312
rtc_data->io + STMP3XXX_RTC_PERSISTENT0_CLR);
313313
return 0;
314314
}
315-
#else
316-
#define stmp3xxx_rtc_suspend NULL
317-
#define stmp3xxx_rtc_resume NULL
318315
#endif
319316

317+
static SIMPLE_DEV_PM_OPS(stmp3xxx_rtc_pm_ops, stmp3xxx_rtc_suspend,
318+
stmp3xxx_rtc_resume);
319+
320320
static const struct of_device_id rtc_dt_ids[] = {
321321
{ .compatible = "fsl,stmp3xxx-rtc", },
322322
{ /* sentinel */ }
@@ -326,11 +326,10 @@ MODULE_DEVICE_TABLE(of, rtc_dt_ids);
326326
static struct platform_driver stmp3xxx_rtcdrv = {
327327
.probe = stmp3xxx_rtc_probe,
328328
.remove = stmp3xxx_rtc_remove,
329-
.suspend = stmp3xxx_rtc_suspend,
330-
.resume = stmp3xxx_rtc_resume,
331329
.driver = {
332330
.name = "stmp3xxx-rtc",
333331
.owner = THIS_MODULE,
332+
.pm = &stmp3xxx_rtc_pm_ops,
334333
.of_match_table = of_match_ptr(rtc_dt_ids),
335334
},
336335
};

0 commit comments

Comments
 (0)