Thread (4 messages) 4 messages, 1 author, 2017-01-25
STALE3417d

[PATCH 2/4] rtc: st-lpc: using devm_rtc_device_register helper

From: Kefeng Wang <hidden>
Date: 2017-01-25 08:41:55
Also in: linux-rtc
Subsystem: arm/sti architecture, real time clock (rtc) subsystem, the rest · Maintainers: Patrice Chotard, Alexandre Belloni, Linus Torvalds

Using devm_rtc_device_register() helper to simplify code.

Cc: Patrice Chotard <redacted>
Cc: Alessandro Zummo <redacted>
Cc: Alexandre Belloni <redacted>
Signed-off-by: Kefeng Wang <redacted>
---
 drivers/rtc/rtc-st-lpc.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
index 74c0a33..4f81124 100644
--- a/drivers/rtc/rtc-st-lpc.c
+++ b/drivers/rtc/rtc-st-lpc.c
@@ -272,8 +272,8 @@ static int st_rtc_probe(struct platform_device *pdev)
 		st_rtc_set_time(&pdev->dev, &tm_check);
 	}
 
-	rtc->rtc_dev = rtc_device_register("st-lpc-rtc", &pdev->dev,
-					   &st_rtc_ops, THIS_MODULE);
+	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "st-lpc-rtc",
+						&st_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc->rtc_dev)) {
 		clk_disable_unprepare(rtc->clk);
 		return PTR_ERR(rtc->rtc_dev);
@@ -282,16 +282,6 @@ static int st_rtc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int st_rtc_remove(struct platform_device *pdev)
-{
-	struct st_rtc *rtc = platform_get_drvdata(pdev);
-
-	if (likely(rtc->rtc_dev))
-		rtc_device_unregister(rtc->rtc_dev);
-
-	return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int st_rtc_suspend(struct device *dev)
 {
@@ -344,7 +334,6 @@ static int st_rtc_resume(struct device *dev)
 		.of_match_table = st_rtc_match,
 	},
 	.probe = st_rtc_probe,
-	.remove = st_rtc_remove,
 };
 
 module_platform_driver(st_rtc_platform_driver);
-- 
1.7.12.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help