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@mba.ocn.ne.jp>
> --- 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
|