From patchwork Mon Feb 7 21:16:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Roberto Jimenez X-Patchwork-Id: 82153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-yx0-f184.google.com (mail-yx0-f184.google.com [209.85.213.184]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 1294EB70B3 for ; Tue, 8 Feb 2011 08:17:13 +1100 (EST) Received: by mail-yx0-f184.google.com with SMTP id 8sf3129134yxk.11 for ; Mon, 07 Feb 2011 13:17:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:mime-version:x-beenthere:received-spf:from:to :cc:subject:date:message-id:x-mailer:in-reply-to:references :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=C9hcpJPSOrH0gHdIFY67jf5ziy9XCs11aaMJrR1PrHE=; b=U8F7vYF3C4tzQnJG3Jcjp6L8MDMmaE1keyp931gLFpHqvKmlDdI4T7QUpGbo8EsiLT sEkyUWhd1GonQLTtf9ouWnr/1QpzG7KLpKoqnKeoPVpED3uikc2laF9gQ9eMP8mCiBYK m/aAwhtKbt7mW7xwSY9Dg5ACQ6cH0zBOMNuP8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=eA+HW+bYYqi2vhDzo1+EQizhx0nzZDAk//DRiE2W6xiVk0dtjKrmNy9cNEmXqrGc9A C+a+GI01B6gqIk/JTleIovK4hI+yyxy9Hm8TGZOB8TDpmRFg8aidDZ7SffafJxylXYj1 yEoCp81Mi9VTRYQ8+uAe0XR7Wienk7QLXHGEc= Received: by 10.101.175.37 with SMTP id c37mr52562anp.32.1297113432623; Mon, 07 Feb 2011 13:17:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.100.56.38 with SMTP id e38ls1122397ana.3.p; Mon, 07 Feb 2011 13:17:12 -0800 (PST) Received: by 10.100.138.18 with SMTP id l18mr4673805and.40.1297113432388; Mon, 07 Feb 2011 13:17:12 -0800 (PST) Received: by 10.100.138.18 with SMTP id l18mr4673804and.40.1297113432346; Mon, 07 Feb 2011 13:17:12 -0800 (PST) Received: from mail-gy0-f176.google.com (mail-gy0-f176.google.com [209.85.160.176]) by gmr-mx.google.com with ESMTPS id i35si1978008anh.10.2011.02.07.13.17.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 07 Feb 2011 13:17:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.176 is neither permitted nor denied by best guess record for domain of mroberto@cpti.cetuc.puc-rio.br) client-ip=209.85.160.176; Received: by gyf1 with SMTP id 1so2103084gyf.35 for ; Mon, 07 Feb 2011 13:17:12 -0800 (PST) Received: by 10.151.103.15 with SMTP id f15mr15946584ybm.251.1297113432097; Mon, 07 Feb 2011 13:17:12 -0800 (PST) Received: from localhost.localdomain ([139.82.178.36]) by mx.google.com with ESMTPS id m49sm3208519yha.2.2011.02.07.13.17.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 07 Feb 2011 13:17:11 -0800 (PST) From: Marcelo Roberto Jimenez To: linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, linux@arm.linux.org.uk Cc: john.stultz@linaro.org, tglx@linutronix.de, a.zummo@towertech.it, Marcelo Roberto Jimenez Subject: [rtc-linux] [PATCH 3/4] RTC: Fix the cross interrupt issue on rtc-test. Date: Mon, 7 Feb 2011 19:16:07 -0200 Message-Id: <1297113368-27174-4-git-send-email-mroberto@cpti.cetuc.puc-rio.br> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1297113368-27174-1-git-send-email-mroberto@cpti.cetuc.puc-rio.br> References: <1297113368-27174-1-git-send-email-mroberto@cpti.cetuc.puc-rio.br> X-Original-Sender: mroberto@cpti.cetuc.puc-rio.br X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.160.176 is neither permitted nor denied by best guess record for domain of mroberto@cpti.cetuc.puc-rio.br) smtp.mail=mroberto@cpti.cetuc.puc-rio.br 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: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , The rtc-test driver is meant to provide a test/debug code for the RTC subsystem. The rtc-test driver simulates specific interrupts by echoing to the sys interface. Those were the update, alarm and periodic interrupts. As a side effect of the new implementation, any interrupt generated in the rtc-test driver would trigger the same code path in the generic code, and thus the distinction among interrupts gets lost. This patch preserves the previous behaviour of the rtc-test driver, where e.g. an update interrupt would not trigger an alarm or periodic interrupt, and vice-versa. In real world RTC drivers, this is not an issue, but in the rtc-test driver it may be interesting to distinguish these interrupts for testing purposes. Signed-off-by: Marcelo Roberto Jimenez --- drivers/rtc/rtc-test.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 61ad5ab..34d5631 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c @@ -71,11 +71,16 @@ static ssize_t test_irq_store(struct device *dev, struct rtc_device *rtc = platform_get_drvdata(plat_dev); retval = count; - if (strncmp(buf, "tick", 4) == 0) + if (strncmp(buf, "tick", 4) == 0 && rtc->pie_enabled) rtc_update_irq(rtc, 1, RTC_PF | RTC_IRQF); - else if (strncmp(buf, "alarm", 5) == 0) - rtc_update_irq(rtc, 1, RTC_AF | RTC_IRQF); - else if (strncmp(buf, "update", 6) == 0) + else if (strncmp(buf, "alarm", 5) == 0) { + struct rtc_wkalrm alrm; + int err = rtc_read_alarm(rtc, &alrm); + + if (!err && alrm.enabled) + rtc_update_irq(rtc, 1, RTC_AF | RTC_IRQF); + + } else if (strncmp(buf, "update", 6) == 0 && rtc->uie_rtctimer.enabled) rtc_update_irq(rtc, 1, RTC_UF | RTC_IRQF); else retval = -EINVAL;