linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] rtc: sa1100: enable/disable rtc when probe/remove the device
@ 2012-11-29  2:21 Chao Xie
  2012-11-29  2:21 ` [PATCH 2/4] rtc: pxa: fix rtc caculation issue Chao Xie
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Chao Xie @ 2012-11-29  2:21 UTC (permalink / raw)
  To: linux-arm-kernel

The original sa1100_rtc_open/sa1100_rtc_release will be called
when the /dev/rtc0 is opened or closed.
In fact, these two functions will enable/disable the clock, and
register/unregister the irqs.
User application will use /dev/rtc0 to read the rtc time or set
the alarm. The rtc should still run indepent of open/close the
rtc device.
So only enable clock and register the irqs when probe the device,
and disable clock and unregister the irqs when remove the device.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 drivers/rtc/rtc-sa1100.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 50a5c4a..e933327 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -218,8 +218,6 @@ static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)
 }
 
 static const struct rtc_class_ops sa1100_rtc_ops = {
-	.open = sa1100_rtc_open,
-	.release = sa1100_rtc_release,
 	.read_time = sa1100_rtc_read_time,
 	.set_time = sa1100_rtc_set_time,
 	.read_alarm = sa1100_rtc_read_alarm,
@@ -253,6 +251,10 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
 	spin_lock_init(&info->lock);
 	platform_set_drvdata(pdev, info);
 
+	ret = sa1100_rtc_open(&pdev->dev);
+	if (ret)
+		goto err_open;
+
 	/*
 	 * According to the manual we should be able to let RTTR be zero
 	 * and then a default diviser for a 32.768KHz clock is used.
@@ -305,7 +307,9 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
 
 	return 0;
 err_dev:
+	sa1100_rtc_release(&pdev->dev);
 	platform_set_drvdata(pdev, NULL);
+err_open:
 	clk_put(info->clk);
 err_clk:
 	kfree(info);
@@ -318,6 +322,7 @@ static int sa1100_rtc_remove(struct platform_device *pdev)
 
 	if (info) {
 		rtc_device_unregister(info->rtc);
+		sa1100_rtc_release(&pdev->dev);
 		clk_put(info->clk);
 		platform_set_drvdata(pdev, NULL);
 		kfree(info);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-12-04  7:03 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29  2:21 [PATCH 1/4] rtc: sa1100: enable/disable rtc when probe/remove the device Chao Xie
2012-11-29  2:21 ` [PATCH 2/4] rtc: pxa: fix rtc caculation issue Chao Xie
2012-11-29 20:04   ` Robert Jarzmik
2012-12-03  2:40     ` Chao Xie
2012-12-04  2:53       ` Chao Xie
2012-11-29  2:21 ` [PATCH 3/4] rtc: pxa: add pxa95x rtc support Chao Xie
2012-12-04  7:03   ` Haojian Zhuang
2012-11-29  2:21 ` [PATCH 4/4] rtc: pxa: request rtc irqs when probe/remove the device Chao Xie
2012-11-29 10:26   ` Russell King - ARM Linux
2012-11-29 20:10   ` Robert Jarzmik
2012-11-29 10:25 ` [PATCH 1/4] rtc: sa1100: enable/disable rtc " Russell King - ARM Linux
2012-11-30  7:04   ` Haojian Zhuang
2012-12-03  1:39     ` Chao Xie
2012-12-03  2:53       ` Chao Xie
2012-12-03  5:35         ` Haojian Zhuang
2012-12-03  5:42           ` Chao Xie
2012-12-03  9:48         ` Russell King - ARM Linux
2012-12-04  2:51           ` Chao Xie
2012-12-04  7:01             ` Haojian Zhuang
2012-12-03  5:33       ` Haojian Zhuang
2012-12-03  5:02 ` devendra.aaru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).