From patchwork Thu Nov 29 02:21:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Xie X-Patchwork-Id: 202647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pb0-f56.google.com (mail-pb0-f56.google.com [209.85.160.56]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 45B212C0085 for ; Thu, 29 Nov 2012 13:25:58 +1100 (EST) Received: by mail-pb0-f56.google.com with SMTP id wz17sf9268809pbc.11 for ; Wed, 28 Nov 2012 18:25:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:x-beenthere:received-spf:from:to:subject:date :message-id:x-mailer:in-reply-to:references:x-originalarrivaltime :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-google-group-id:list-post :list-help:list-archive:sender:list-subscribe:list-unsubscribe :content-type; bh=UE/PA3TZOaXVmJSKoiryKbFMnM+GXvZp0jWgSJ3w8fg=; b=sme81EG4RBnpway/n2or77gU1MdWo7ijLSB966QRpzRyVdKy21eLHSGFfOhI3bOw5C o5aFVHPX1uTvD57sHV3+GlDbXswtqO0+nekEQVI0k7GbSi9nW4MOLHDXNeKderZHHL26 +PjQBPlxf6C+KPrAxDTeQdyNmxHkg/nSA8/7w1ulkXs6hQHWstSw1dBPDd+wseTurF1e QMX3tqXGemJ/kpIINpbkeyy5Q6jfWP3yiD4lJig5WsaNOaT3/SSWcfKCsGbwI4T0GwFv WKVnM+TxQp7emghokpLAJtCXhAh7Si2WE3PTqOQSzhrF029wIabmjaxXnwRMg89NQAJg 9N5g== Received: by 10.50.12.169 with SMTP id z9mr7901782igb.1.1354155955563; Wed, 28 Nov 2012 18:25:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.46.230 with SMTP id y6ls4808552igm.43.gmail; Wed, 28 Nov 2012 18:25:54 -0800 (PST) Received: by 10.66.86.39 with SMTP id m7mr4611459paz.4.1354155954390; Wed, 28 Nov 2012 18:25:54 -0800 (PST) Received: by 10.66.86.39 with SMTP id m7mr4611458paz.4.1354155954379; Wed, 28 Nov 2012 18:25:54 -0800 (PST) Received: from na3sys009aog114.obsmtp.com (na3sys009aog114.obsmtp.com [74.125.149.211]) by gmr-mx.google.com with SMTP id r4si36839paz.1.2012.11.28.18.25.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 18:25:54 -0800 (PST) Received-SPF: neutral (google.com: 74.125.149.211 is neither permitted nor denied by best guess record for domain of cxie4@marvell.com) client-ip=74.125.149.211; Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob114.postini.com ([74.125.148.12]) with SMTP ID DSNKULbHlv1O8j5ZD7rk48G675kBaeVPW0cH@postini.com; Wed, 28 Nov 2012 18:25:54 PST Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 28 Nov 2012 18:21:04 -0800 Received: from localhost (unknown [10.38.36.205]) by maili.marvell.com (Postfix) with ESMTP id 5ECAB4E513; Wed, 28 Nov 2012 18:21:04 -0800 (PST) From: Chao Xie To: a.zummo@towertech.it, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, haojian.zhuang@gmail.com, linux-arm-kernel@lists.infradead.org, xiechao.mail@gmail.com Subject: [rtc-linux] [PATCH 4/4] rtc: pxa: request rtc irqs when probe/remove the device Date: Wed, 28 Nov 2012 21:21:10 -0500 Message-Id: <1354155670-6267-4-git-send-email-chao.xie@marvell.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1354155670-6267-1-git-send-email-chao.xie@marvell.com> References: <1354155670-6267-1-git-send-email-chao.xie@marvell.com> X-OriginalArrivalTime: 29 Nov 2012 02:21:04.0437 (UTC) FILETIME=[2EBCD650:01CDCDD8] X-Original-Sender: cxie4@marvell.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 74.125.149.211 is neither permitted nor denied by best guess record for domain of cxie4@marvell.com) smtp.mail=cxie4@marvell.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , 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 --- 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);