[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090409153921.04b6384c.akpm@linux-foundation.org>
Date: Thu, 9 Apr 2009 15:39:21 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Atsushi Nemoto <anemo@....ocn.ne.jp>
Cc: a.zummo@...ertech.it, rtc-linux@...glegroups.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rtc: Make rtc_update_irq callable with irqs enabled
On Tue, 7 Apr 2009 01:50:31 +0900
Atsushi Nemoto <anemo@....ocn.ne.jp> wrote:
> The rtc_update_irq() might be called with irqs enabled, if a interrupt
> handler was registered without IRQF_DISABLED.
Why? What are the consequences of not merging the patch? Is it a
bugfix? If so, what are the user-visible effects of the bug?
See, I need to decide if this patch is needed in 2.6.30 (and earlier),
but the changelog doesn't include enough info to make that decision.
> Use spin_lock_irqsave/spin_unlock_irqrestore instead of
> spin_lock/spin_unlock.
>
> Signed-off-by: Atsushi Nemoto <anemo@....ocn.ne.jp>
> ---
> drivers/rtc/interface.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
> index 4348c4b..a8641f7 100644
> --- a/drivers/rtc/interface.c
> +++ b/drivers/rtc/interface.c
> @@ -376,14 +376,16 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable);
> void rtc_update_irq(struct rtc_device *rtc,
> unsigned long num, unsigned long events)
> {
> - spin_lock(&rtc->irq_lock);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&rtc->irq_lock, flags);
> rtc->irq_data = (rtc->irq_data + (num << 8)) | events;
> - spin_unlock(&rtc->irq_lock);
> + spin_unlock_irqrestore(&rtc->irq_lock, flags);
>
> - spin_lock(&rtc->irq_task_lock);
> + spin_lock_irqsave(&rtc->irq_task_lock, flags);
> if (rtc->irq_task)
> rtc->irq_task->func(rtc->irq_task->private_data);
> - spin_unlock(&rtc->irq_task_lock);
> + spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
>
> wake_up_interruptible(&rtc->irq_queue);
> kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists