Patchwork [V2,22/30] rtc: rtc-spear: use devm_rtc_device_register()

login
register
mail settings
Submitter Jingoo Han
Date March 6, 2013, 7:54 a.m.
Message ID <009001ce1a3f$e3d015d0$ab704170$%han@samsung.com>
Download mbox | patch
Permalink /patch/225416/
State New
Headers show

Comments

Jingoo Han - March 6, 2013, 7:54 a.m.
devm_rtc_device_register() is device managed and makes cleanup
paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
Changes since v1:
- used 'struct device *dev' as the first argument

 drivers/rtc/rtc-spear.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
viresh kumar - March 6, 2013, 1:39 p.m.
On Wed, Mar 6, 2013 at 3:54 PM, Jingoo Han <jg1.han@samsung.com> wrote:
> devm_rtc_device_register() is device managed and makes cleanup
> paths simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> Changes since v1:
> - used 'struct device *dev' as the first argument
>
>  drivers/rtc/rtc-spear.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Patch

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index a18c319..db3ef61 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);