Re: Patch 3/3: Reduce number of get_cmos_time_calls.

From: Pavel Machek
Date: Sat Jan 08 2005 - 08:31:54 EST


Hi!

> Create new __get_cmos_time patch, which doesn't wait for the start of a
> new second before returning. Adjust timer_suspend to use this as we
> don't appear to need the exact start of a second when suspending.

Basically nice cleanup. I do not know if this does not mean up-to
second error in clock for each suspend/resume?

> --- 913-old/arch/x86_64/kernel/time.c 2004-12-10 14:27:08.000000000 +1100
> +++ 913-new/arch/x86_64/kernel/time.c 2005-01-08 19:39:24.664278320 +1100
> @@ -499,11 +499,56 @@ unsigned long long sched_clock(void)
> return cycles_2_ns(a);
> }
>
> +unsigned long __get_cmos_time(void)
> +{

Missing static?

> +
> + /*
> + * Do we need the spinlock in here too?
> + *
> + * If we're called directly (not via get_cmos_time),
> + * we're in the middle of a sysdev suspend/resume
> + * and interrupts are disabled, so this
> + * should be safe without any locking.
> + * -- NC
> + */

I'd say "Caller is responsible for locking"... and explain this in
caller. Also do not sign comments.

> + do {
> + sec = CMOS_READ(RTC_SECONDS);
> + min = CMOS_READ(RTC_MINUTES);
> + hour = CMOS_READ(RTC_HOURS);
> + day = CMOS_READ(RTC_DAY_OF_MONTH);
> + mon = CMOS_READ(RTC_MONTH);
> + year = CMOS_READ(RTC_YEAR);
> + } while (sec != CMOS_READ(RTC_SECONDS));
> +
> + /*
> + * We know that x86-64 always uses BCD format, no need to check the config
> + * register.
> + */
> +
> + BCD_TO_BIN(sec);
> + BCD_TO_BIN(min);
> + BCD_TO_BIN(hour);
> + BCD_TO_BIN(day);
> + BCD_TO_BIN(mon);
> + BCD_TO_BIN(year);

Whitespace damage?
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/