Re: [patch-mm 14/25] NTP: Move the cmos update code into ntp.c

From: Franck Bui-Huu
Date: Tue Jun 19 2007 - 04:26:17 EST


Hi Thomas,

Thomas Gleixner wrote:
> i386 and sparc64 have the identical code to update the cmos clock.
> Move it into kernel/time/ntp.c as there are other architectures
> coming along with the same requirements.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Chris Wright <chrisw@xxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> Cc: john stultz <johnstul@xxxxxxxxxx>
> Cc: David Miller <davem@xxxxxxxxxxxxx>
>
> ---
> arch/i386/Kconfig | 4 +++
> arch/i386/kernel/time.c | 50 +-------------------------------------
> arch/sparc64/Kconfig | 4 +++
> arch/sparc64/kernel/time.c | 53 +---------------------------------------
> include/asm-i386/timer.h | 1
> include/linux/time.h | 2 +
> kernel/time/ntp.c | 59 ++++++++++++++++++++++++++++++++++++++++++---
> 7 files changed, 70 insertions(+), 103 deletions(-)
>

[snip]

> /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */
> Index: linux-2.6.22-rc4-mm/include/linux/time.h
> ===================================================================
> --- linux-2.6.22-rc4-mm.orig/include/linux/time.h 2007-06-16 12:10:21.000000000 +0200
> +++ linux-2.6.22-rc4-mm/include/linux/time.h 2007-06-16 12:10:24.000000000 +0200
> @@ -93,6 +93,8 @@ extern struct timespec wall_to_monotonic
> extern seqlock_t xtime_lock __attribute__((weak));
>
> extern unsigned long read_persistent_clock(void);
> +extern int update_persistent_clock(struct timespec now);

I'm wondering if update_persistent_clock shouldn't be part of
"drivers/rtc/*" framework. Do you have any idea on how this
is going to be implemented on platforms that use this framework ?

> +extern int no_sync_cmos_clock __read_mostly;
> void timekeeping_init(void);
>
> static inline unsigned long get_seconds(void)
> Index: linux-2.6.22-rc4-mm/kernel/time/ntp.c
> ===================================================================
> --- linux-2.6.22-rc4-mm.orig/kernel/time/ntp.c 2007-06-16 12:10:21.000000000 +0200
> +++ linux-2.6.22-rc4-mm/kernel/time/ntp.c 2007-06-16 12:10:24.000000000 +0200
> @@ -10,6 +10,7 @@
>
> #include <linux/mm.h>
> #include <linux/time.h>
> +#include <linux/timer.h>
> #include <linux/timex.h>
> #include <linux/jiffies.h>
> #include <linux/hrtimer.h>
> @@ -187,12 +188,64 @@ u64 current_tick_length(void)
> return tick_length;
> }
>
> +#ifdef CONFIG_GENERIC_CMOS_UPDATE
>
> -void __attribute__ ((weak)) notify_arch_cmos_timer(void)
> +/* Disable the cmos update - used by virtualization and embedded */
> +int no_sync_cmos_clock __read_mostly;
> +

[snip]

>
> +static void notify_cmos_timer(void)
> +{
> + if (no_sync_cmos_clock)
> + mod_timer(&sync_cmos_timer, jiffies + 1);
> +}

Isn't the test condition wrong ? Shouldn't it be:

if (!no_sync_cmos_clock)
mod_timer(&sync_cmos_timer, jiffies + 1);

Thanks,

Franck
-
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/