mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Donggeun Kim <dg77.kim@samsung.com>
Cc: rtc-linux@googlegroups.com, a.zummo@towertech.it,
	linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com,
	kyungmin.park@samsung.com
Subject: Re: [PATCH] rtc: rtc-s3c: fix no occurrence of alarm interrupt
Date: Thu, 8 Sep 2011 16:52:47 -0700	[thread overview]
Message-ID: <20110908165247.32902b28.akpm@linux-foundation.org> (raw)
In-Reply-To: <1314786110-1297-1-git-send-email-dg77.kim@samsung.com>

On Wed, 31 Aug 2011 19:21:50 +0900
Donggeun Kim <dg77.kim@samsung.com> 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;
 
_


      reply	other threads:[~2011-09-08 23:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 10:21 Donggeun Kim
2011-09-08 23:52 ` Andrew Morton [this message]

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=20110908165247.32902b28.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.zummo@towertech.it \
    --cc=dg77.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rtc-linux@googlegroups.com \
    /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

Powered by JetHome