linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: chao.xie@marvell.com (Chao Xie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] rtc: pxa: request rtc irqs when probe/remove the device
Date: Wed, 28 Nov 2012 21:21:10 -0500	[thread overview]
Message-ID: <1354155670-6267-4-git-send-email-chao.xie@marvell.com> (raw)
In-Reply-To: <1354155670-6267-1-git-send-email-chao.xie@marvell.com>

The original pxa_rtc_open/pxa_rtc_release will be called
when the /dev/rtc0 is opened or closed.
In fact, these two functions will 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 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-pxa.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index 29646af..19abeb8 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -340,8 +340,6 @@ static int pxa_rtc_proc(struct device *dev, struct seq_file *seq)
 }
 
 static const struct rtc_class_ops pxa_rtc_ops = {
-	.open = pxa_rtc_open,
-	.release = pxa_rtc_release,
 	.read_time = pxa_rtc_read_time,
 	.set_time = pxa_rtc_set_time,
 	.read_alarm = pxa_rtc_read_alarm,
@@ -435,6 +433,11 @@ static int __init pxa_rtc_probe(struct platform_device *pdev)
 		}
 	}
 
+	ret = pxa_rtc_open(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "Unable to request irqs for rtc\n");
+		goto err_open;
+	}
 	/*
 	 * If the clock divider is uninitialized then reset it to the
 	 * default value to get the 1Hz clock.
@@ -461,6 +464,8 @@ static int __init pxa_rtc_probe(struct platform_device *pdev)
 	return 0;
 
 err_rtc_reg:
+	pxa_rtc_release(&pdev->dev);
+err_open:
 	if (pxa_rtc->id == RTC_PXA95X)
 		 iounmap(pxa_rtc->base_psbr);
 err_map_base_psbr:
@@ -477,6 +482,8 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev)
 
 	rtc_device_unregister(pxa_rtc->rtc);
 
+	pxa_rtc_release(&pdev->dev);
+
 	spin_lock_irq(&pxa_rtc->lock);
 	iounmap(pxa_rtc->base);
 	spin_unlock_irq(&pxa_rtc->lock);
-- 
1.7.4.1

  parent reply	other threads:[~2012-11-29  2:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Chao Xie [this message]
2012-11-29 10:26   ` [PATCH 4/4] rtc: pxa: request rtc irqs when probe/remove the device 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354155670-6267-4-git-send-email-chao.xie@marvell.com \
    --to=chao.xie@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).