diff options
Diffstat (limited to 'drivers/rtc/rtc-spear.c')
-rw-r--r-- | drivers/rtc/rtc-spear.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index a18c3192ed40..574359c48f65 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c @@ -400,8 +400,8 @@ static int spear_rtc_probe(struct platform_device *pdev) spin_lock_init(&config->lock); platform_set_drvdata(pdev, config); - config->rtc = rtc_device_register(pdev->name, &pdev->dev, - &spear_rtc_ops, THIS_MODULE); + config->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, + &spear_rtc_ops, THIS_MODULE); if (IS_ERR(config->rtc)) { dev_err(&pdev->dev, "can't register RTC device, err %ld\n", PTR_ERR(config->rtc)); @@ -427,7 +427,6 @@ static int spear_rtc_remove(struct platform_device *pdev) { struct spear_rtc_config *config = platform_get_drvdata(pdev); - rtc_device_unregister(config->rtc); spear_rtc_disable_interrupt(config); clk_disable_unprepare(config->clk); device_init_wakeup(&pdev->dev, 0); @@ -435,10 +434,10 @@ static int spear_rtc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM - -static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int spear_rtc_suspend(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct spear_rtc_config *config = platform_get_drvdata(pdev); int irq; @@ -454,8 +453,9 @@ static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int spear_rtc_resume(struct platform_device *pdev) +static int spear_rtc_resume(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct spear_rtc_config *config = platform_get_drvdata(pdev); int irq; @@ -473,12 +473,10 @@ static int spear_rtc_resume(struct platform_device *pdev) return 0; } - -#else -#define spear_rtc_suspend NULL -#define spear_rtc_resume NULL #endif +static SIMPLE_DEV_PM_OPS(spear_rtc_pm_ops, spear_rtc_suspend, spear_rtc_resume); + static void spear_rtc_shutdown(struct platform_device *pdev) { struct spear_rtc_config *config = platform_get_drvdata(pdev); @@ -498,11 +496,10 @@ MODULE_DEVICE_TABLE(of, spear_rtc_id_table); static struct platform_driver spear_rtc_driver = { .probe = spear_rtc_probe, .remove = spear_rtc_remove, - .suspend = spear_rtc_suspend, - .resume = spear_rtc_resume, .shutdown = spear_rtc_shutdown, .driver = { .name = "rtc-spear", + .pm = &spear_rtc_pm_ops, .of_match_table = of_match_ptr(spear_rtc_id_table), }, }; |