From patchwork Tue Mar 2 17:51:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 46644 Return-Path: <3oU-NSxAJCcky32p8wp2.rp1t632v1px0.r3168r-0x29Cv33v0tv63947.r31@groups.bounces.google.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-gw0-f56.google.com (mail-gw0-f56.google.com [74.125.83.56]) by ozlabs.org (Postfix) with ESMTP id A227AB7D53 for ; Wed, 3 Mar 2010 04:49:23 +1100 (EST) Received: by gwj19 with SMTP id 19sf709350gwj.11 for ; Tue, 02 Mar 2010 09:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:x-cam-antivirus:x-cam-spamdetails :x-cam-scannerinfo:received:message-id:date:from:user-agent :mime-version:to:cc:subject:x-enigmail-version :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :x-thread-url:x-message-url:sender:list-subscribe:list-unsubscribe :content-type; bh=C8XZ6TPw3eqMU+B1wPzHrmbhEKmE23A6lQ/1jiMz6Zg=; b=Q0wzBeOajygKMXxUjVIrMWZaAmqFrTiLGThPIHfY6F5DE7kT8bwqmRD95NedjLnaru 4YU3kDVWTg08zIH3O73/iMzt32Gn/6G3X+uwjKVwQ3qI476ls6/5FPSRwX25GeXqgHqI IbQAiqxl+8U7u9LrdkJgLHqB+eOTCALczL+J0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:x-cam-antivirus:x-cam-spamdetails :x-cam-scannerinfo:message-id:date:from:user-agent:mime-version:to :cc:subject:x-enigmail-version:x-original-authentication-results :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:x-thread-url:x-message-url:sender :list-subscribe:list-unsubscribe:content-type; b=dnmktSF3pStjKrqUAHROvzCntJPJ0Eq7BWSjF966MjkjfnbsESLmYDm0HXFu3tjIhh koXlANJOezUo/+ugPy6P4Hswe1dtd8sxYyCGSDaq27y+gAiUQCkISfnRNAJSAeTJn83p Isqal3+2vvp2oM9g/Yl4XNAJuIvG4kDCLHDhk= Received: by 10.150.173.2 with SMTP id v2mr157641ybe.35.1267552162051; Tue, 02 Mar 2010 09:49:22 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.204.27.2 with SMTP id g2ls1087990bkc.0.p; Tue, 02 Mar 2010 09:49:20 -0800 (PST) Received: by 10.204.144.15 with SMTP id x15mr286957bku.39.1267552160110; Tue, 02 Mar 2010 09:49:20 -0800 (PST) Received: by 10.204.144.15 with SMTP id x15mr286954bku.39.1267552159527; Tue, 02 Mar 2010 09:49:19 -0800 (PST) Received: from ppsw-0.csi.cam.ac.uk (ppsw-0.csi.cam.ac.uk [131.111.8.130]) by gmr-mx.google.com with ESMTP id h21si720148bkh.1.2010.03.02.09.49.19; Tue, 02 Mar 2010 09:49:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of jic23@cam.ac.uk designates 131.111.8.130 as permitted sender) client-ip=131.111.8.130; X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from arcturus.eng.cam.ac.uk ([129.169.154.73]:47200) by ppsw-0.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.150]:25) with esmtpsa (PLAIN:jic23) (TLSv1:DHE-RSA-AES256-SHA:256) id 1NmWDe-00044k-2u (Exim 4.70) (return-path ); Tue, 02 Mar 2010 17:49:18 +0000 Message-ID: <4B8D501B.9010607@cam.ac.uk> Date: Tue, 02 Mar 2010 17:51:23 +0000 From: Jonathan Cameron User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20100109 Thunderbird/3.0 MIME-Version: 1.0 To: Robert Jarzmik CC: rtc-linux@googlegroups.com, Richard Purdie , Ben Dooks Subject: [rtc-linux] rtc-pxa: why are irq's only requested in the open call()? X-Enigmail-Version: 1.0 X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of jic23@cam.ac.uk designates 131.111.8.130 as permitted sender) smtp.mail=jic23@cam.ac.uk X-Original-Sender: jonathan.cameron@gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: X-Thread-Url: http://groups.google.com/group/rtc-linux/t/e6e12052fabfc2b7 X-Message-Url: http://groups.google.com/group/rtc-linux/msg/4abd1cb67ba74bc8 Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Dear Robert, I've run into an issue with your rtc-pxa driver. If one is using the driver via the in kernel interfaces (rather than from userspace,) in my case for the periodic timer to drive an IIO trigger, then the open call never occurs and hence the relevant irq's are never requested. Obviously putting those calls in open is nice and tidy for a driver only accessed by userspace, but for in kernel calls, I guess they should be requested in the driver probe rather than on file open. Do you have any objection to a patch to do this? For reference, rtc-s3c, rtc-sa1100 do the same sort of thing and so I guess would cause the same issues with in kernel users. I can provide patches for both of those, but can only test the sa1100 driver (on pxa27x). Thanks, Jonathan p.s I haven't tested the following as yet, but will do that this evening. Signed-off-by: Jonathan Cameron --- drivers/rtc/rtc-pxa.c | 55 +++++++++++++++++++----------------------------- 1 files changed, 22 insertions(+), 33 deletions(-) diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index e6351b7..1996971 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c @@ -169,34 +169,6 @@ static irqreturn_t pxa_rtc_irq(int irq, void *dev_id) return IRQ_HANDLED; } -static int pxa_rtc_open(struct device *dev) -{ - struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); - int ret; - - ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, IRQF_DISABLED, - "rtc 1Hz", dev); - if (ret < 0) { - dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_1Hz, - ret); - goto err_irq_1Hz; - } - ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, IRQF_DISABLED, - "rtc Alrm", dev); - if (ret < 0) { - dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_Alrm, - ret); - goto err_irq_Alrm; - } - - return 0; - -err_irq_Alrm: - free_irq(pxa_rtc->irq_1Hz, dev); -err_irq_1Hz: - return ret; -} - static void pxa_rtc_release(struct device *dev) { struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); @@ -204,9 +176,6 @@ static void pxa_rtc_release(struct device *dev) spin_lock_irq(&pxa_rtc->lock); rtsr_clear_bits(pxa_rtc, RTSR_PIALE | RTSR_RDALE1 | RTSR_HZE); spin_unlock_irq(&pxa_rtc->lock); - - free_irq(pxa_rtc->irq_Alrm, dev); - free_irq(pxa_rtc->irq_1Hz, dev); } static int pxa_periodic_irq_set_freq(struct device *dev, int freq) @@ -337,7 +306,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, .ioctl = pxa_rtc_ioctl, .read_time = pxa_rtc_read_time, @@ -410,15 +378,34 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) goto err_rtc_reg; } + ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, IRQF_DISABLED, + "rtc 1Hz", dev); + if (ret < 0) { + dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_1Hz, + ret); + goto err_irq_1Hz; + } + ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, IRQF_DISABLED, + "rtc Alrm", dev); + if (ret < 0) { + dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_Alrm, + ret); + goto err_irq_Alrm; + } + device_init_wakeup(dev, 1); return 0; - +err_irq_Alrm: + free_irq(pxa_rtc->irq_1Hz, dev); +err_irq_1Hz: + rtc_device_unregister(pxa_rtc->rtc); err_rtc_reg: iounmap(pxa_rtc->base); err_ress: err_map: kfree(pxa_rtc); + return ret; } @@ -426,6 +413,8 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev) { struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); + free_irq(pxa_rtc->irq_Alrm, &pdev->dev); + free_irq(pxa_rtc->irq_1Hz, &pdev->dev); rtc_device_unregister(pxa_rtc->rtc); spin_lock_irq(&pxa_rtc->lock);