diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2013-04-29 19:19:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:28 -0400 |
commit | 68567112ee3fa3c4eec0c525c39929564809dbb4 (patch) | |
tree | 5c8160db187fcb7e41ed986ca25c5491b00f58cb | |
parent | 57bff981f7ebc9b4617f84d425081dbddcf9f963 (diff) |
drivers/rtc/rtc-tegra.c: use managed rtc_device_register()
Use devm_rtc_device_register() for registering RTC device. This will
reduce the code for unregistering RTC device in cleanup path and remove
the implementation of remove callback of platform driver.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/rtc/rtc-tegra.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index e9f0d530121e..a34315d25478 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c | |||
@@ -349,13 +349,12 @@ static int __init tegra_rtc_probe(struct platform_device *pdev) | |||
349 | 349 | ||
350 | device_init_wakeup(&pdev->dev, 1); | 350 | device_init_wakeup(&pdev->dev, 1); |
351 | 351 | ||
352 | info->rtc_dev = rtc_device_register( | 352 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, |
353 | pdev->name, &pdev->dev, &tegra_rtc_ops, THIS_MODULE); | 353 | dev_name(&pdev->dev), &tegra_rtc_ops, |
354 | THIS_MODULE); | ||
354 | if (IS_ERR(info->rtc_dev)) { | 355 | if (IS_ERR(info->rtc_dev)) { |
355 | ret = PTR_ERR(info->rtc_dev); | 356 | ret = PTR_ERR(info->rtc_dev); |
356 | info->rtc_dev = NULL; | 357 | dev_err(&pdev->dev, "Unable to register device (err=%d).\n", |
357 | dev_err(&pdev->dev, | ||
358 | "Unable to register device (err=%d).\n", | ||
359 | ret); | 358 | ret); |
360 | return ret; | 359 | return ret; |
361 | } | 360 | } |
@@ -367,28 +366,12 @@ static int __init tegra_rtc_probe(struct platform_device *pdev) | |||
367 | dev_err(&pdev->dev, | 366 | dev_err(&pdev->dev, |
368 | "Unable to request interrupt for device (err=%d).\n", | 367 | "Unable to request interrupt for device (err=%d).\n", |
369 | ret); | 368 | ret); |
370 | goto err_dev_unreg; | 369 | return ret; |
371 | } | 370 | } |
372 | 371 | ||
373 | dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); | 372 | dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); |
374 | 373 | ||
375 | return 0; | 374 | return 0; |
376 | |||
377 | err_dev_unreg: | ||
378 | rtc_device_unregister(info->rtc_dev); | ||
379 | |||
380 | return ret; | ||
381 | } | ||
382 | |||
383 | static int __exit tegra_rtc_remove(struct platform_device *pdev) | ||
384 | { | ||
385 | struct tegra_rtc_info *info = platform_get_drvdata(pdev); | ||
386 | |||
387 | rtc_device_unregister(info->rtc_dev); | ||
388 | |||
389 | platform_set_drvdata(pdev, NULL); | ||
390 | |||
391 | return 0; | ||
392 | } | 375 | } |
393 | 376 | ||
394 | #ifdef CONFIG_PM_SLEEP | 377 | #ifdef CONFIG_PM_SLEEP |
@@ -440,7 +423,6 @@ static void tegra_rtc_shutdown(struct platform_device *pdev) | |||
440 | 423 | ||
441 | MODULE_ALIAS("platform:tegra_rtc"); | 424 | MODULE_ALIAS("platform:tegra_rtc"); |
442 | static struct platform_driver tegra_rtc_driver = { | 425 | static struct platform_driver tegra_rtc_driver = { |
443 | .remove = __exit_p(tegra_rtc_remove), | ||
444 | .shutdown = tegra_rtc_shutdown, | 426 | .shutdown = tegra_rtc_shutdown, |
445 | .driver = { | 427 | .driver = { |
446 | .name = "tegra_rtc", | 428 | .name = "tegra_rtc", |