Re: [PATCH] use rtc_lock to protect RTC operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 03, 2005 at 01:01:15AM +0900, Atsushi Nemoto wrote:

> Many RTC routines are not protected each other.  There are potential
> race, for example, ntp-update and /dev/rtc.  This patch fixes them
> using rtc_lock.
> 
> Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>

> --- a/arch/mips/dec/time.c
> +++ b/arch/mips/dec/time.c
> @@ -37,10 +37,25 @@
>  #include <asm/dec/machtype.h>
>  
>  
> +/*
> + * Returns true if a clock update is in progress
> + */
> +static inline unsigned char dec_rtc_is_updating(void)
> +{
> +	unsigned char uip;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&rtc_lock, flags);
> +	uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
> +	spin_unlock_irqrestore(&rtc_lock, flags);

Unlike on PC CMOS_READ on a DEC is a single read operation, so atomic
and so doesn't need to be protected.  I'd have to check the datasheet
for any other reason why it might need locking though, so I apply your
patch for now and leave this to Maciej for later optimization.

  Ralf


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux