From patchwork Thu Sep 8 23:52:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 114003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pz0-f56.google.com (mail-pz0-f56.google.com [209.85.210.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id B24B8B6F18 for ; Fri, 9 Sep 2011 09:52:54 +1000 (EST) Received: by pzk33 with SMTP id 33sf2552360pzk.21 for ; Thu, 08 Sep 2011 16:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:date:from:to:cc:subject:message-id :in-reply-to:references:x-mailer:mime-version:x-scanned-by :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=YdoZQxVl2RTsxN6p75C3ZAcgyzTi2n3H+OGWTV6SNCY=; b=AX+Jxtnsf6KaJnV/jXORA3b1yeEUbTal2D09LC79qhmE3ZWB/GiVWamOHPDU+rurwo nb7TnB2txh5wLACEmBwjYBhYUzopykIeqTgQBj8hqHBQeeBJJo+c3WSln/D4Y48Bqq1U oe1tph+X1Pm/IaLqI33rWklysS1MzvbCBNS64= Received: by 10.68.2.35 with SMTP id 3mr460923pbr.53.1315525971012; Thu, 08 Sep 2011 16:52:51 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.68.34.164 with SMTP id a4ls455644pbj.1.gmail; Thu, 08 Sep 2011 16:52:50 -0700 (PDT) Received: by 10.68.23.72 with SMTP id k8mr753509pbf.19.1315525970669; Thu, 08 Sep 2011 16:52:50 -0700 (PDT) Received: by 10.68.23.72 with SMTP id k8mr753508pbf.19.1315525970658; Thu, 08 Sep 2011 16:52:50 -0700 (PDT) Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org. [140.211.169.13]) by gmr-mx.google.com with ESMTPS id j4si8320667pbi.2.2011.09.08.16.52.50 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Sep 2011 16:52:50 -0700 (PDT) Received-SPF: pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.13 as permitted sender) client-ip=140.211.169.13; Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p88NqohH028041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Sep 2011 16:52:50 -0700 Received: from akpm.mtv.corp.google.com (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id p88NqmAx015714; Thu, 8 Sep 2011 16:52:48 -0700 Date: Thu, 8 Sep 2011 16:52:47 -0700 From: Andrew Morton To: Donggeun Kim Cc: rtc-linux@googlegroups.com, a.zummo@towertech.it, linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com, kyungmin.park@samsung.com Subject: [rtc-linux] Re: [PATCH] rtc: rtc-s3c: fix no occurrence of alarm interrupt Message-Id: <20110908165247.32902b28.akpm@linux-foundation.org> In-Reply-To: <1314786110-1297-1-git-send-email-dg77.kim@samsung.com> References: <1314786110-1297-1-git-send-email-dg77.kim@samsung.com> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 X-Original-Sender: akpm@linux-foundation.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.13 as permitted sender) smtp.mail=akpm@linux-foundation.org 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: , On Wed, 31 Aug 2011 19:21:50 +0900 Donggeun Kim wrote: > The driver does not generate alarm interrupt > even though time for alarm is set. > This results from disabling rtc_clk after setting time for alarm. > To generate alarm interrupt, > the driver should maintain enabled state for rtc_clk > until alarm interrupt occurs. > This patch allows to generate alarm interrupt. > > ... > > +static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock); > + > +static void s3c_rtc_alarm_clk_enable(bool enable) > +{ > + static bool alarm_clk_enabled; > + unsigned long irq_flags; > + > + spin_lock_irqsave(&s3c_rtc_alarm_clk_lock, irq_flags); > + if (enable) { > + if (!alarm_clk_enabled) { > + clk_enable(rtc_clk); > + alarm_clk_enabled = true; > + } > + } else { > + if (alarm_clk_enabled) { > + clk_disable(rtc_clk); > + alarm_clk_enabled = false; > + } > + } > + spin_unlock_irqrestore(&s3c_rtc_alarm_clk_lock, irq_flags); > +} s3c_rtc_alarm_clk_lock is only used within s3c_rtc_alarm_clk_enable(), so we can reduce its scope: --- a/drivers/rtc/rtc-s3c.c~rtc-rtc-s3c-fix-no-occurrence-of-alarm-interrupt-fix +++ a/drivers/rtc/rtc-s3c.c @@ -50,10 +50,10 @@ static bool wake_en; static enum s3c_cpu_type s3c_rtc_cpu_type; static DEFINE_SPINLOCK(s3c_rtc_pie_lock); -static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock); static void s3c_rtc_alarm_clk_enable(bool enable) { + static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock); static bool alarm_clk_enabled; unsigned long irq_flags;