Patchwork [2/3] rtc: rtc-s3c: Add spin_lock_irq in s3c_rtc_setaie

login
register
mail settings
Submitter Kukjin Kim
Date Nov. 16, 2010, 12:02 a.m.
Message ID <1289865774-31073-3-git-send-email-kgene.kim@samsung.com>
Download mbox | patch
Permalink /patch/71318/
State Under Review
Headers show

Comments

Kukjin Kim - Nov. 16, 2010, 12:02 a.m.
This patch adds spin_lock_irq() and spin_unlock_irq() during
alarm interrupt configuration to avoid interrupt missing.

Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 drivers/rtc/rtc-s3c.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Alexandre Belloni - May 2, 2015, 2 p.m.
Hi Kukjin,

On 16/11/2010 at 09:02:53 +0900, Kukjin Kim wrote :
> This patch adds spin_lock_irq() and spin_unlock_irq() during
> alarm interrupt configuration to avoid interrupt missing.
> 
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: Wan ZongShun <mcuos.com@gmail.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>

This patch never made it in the mainline, is it still necessary?

> ---
>  drivers/rtc/rtc-s3c.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index e2636ff..bb88027 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -82,12 +82,14 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
>  
>  	pr_debug("%s: aie=%d\n", __func__, enabled);
>  
> +	spin_lock_irq(&s3c_rtc_pie_lock);
>  	tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
>  
>  	if (enabled)
>  		tmp |= S3C2410_RTCALM_ALMEN;
>  
>  	writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
> +	spin_unlock_irq(&s3c_rtc_pie_lock);
>  
>  	return 0;
>  }

Patch

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index e2636ff..bb88027 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -82,12 +82,14 @@  static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
 
 	pr_debug("%s: aie=%d\n", __func__, enabled);
 
+	spin_lock_irq(&s3c_rtc_pie_lock);
 	tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
 
 	if (enabled)
 		tmp |= S3C2410_RTCALM_ALMEN;
 
 	writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
+	spin_unlock_irq(&s3c_rtc_pie_lock);
 
 	return 0;
 }