Re: [PATCH 3/5] cleanups ntp.c (from Ingo)

From: Roman Zippel
Date: Sat Mar 15 2008 - 01:24:31 EST


Hi,

On Fri, 14 Mar 2008, john stultz wrote:

> -#define MAX_TICKADJ 500 /* microsecs */
> +static const long max_tickadj = 500; /* (usec) */

That's a matter of taste, but MAX_TICKADJ just works as well, so why
change it?

> /* TIME_ERROR prevents overwriting the CMOS clock */
> -static int time_state = TIME_OK; /* clock synchronization status */
> -int time_status = STA_UNSYNC; /* clock status bits */
> -static long time_tai; /* TAI offset (s) */
> -static s64 time_offset; /* time adjustment (ns) */
> -static long time_constant = 2; /* pll time constant */
> -long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */
> -long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */
> -static s64 time_freq; /* frequency offset (scaled ns/s)*/
> -static long time_reftime; /* time at last adjustment (s) */
> -long time_adjust;
> -static long ntp_tick_adj;
> +static int time_state = TIME_OK; /* clock synch status */
> +int time_status = STA_UNSYNC; /* clock status bits */
> +static long time_tai; /* TAI offset (s) */
> +static s64 time_offset; /* time adjustment (ns) */
> +static long time_constant = 2; /* pll time constant */
> +long time_maxerror = NTP_PHASE_LIMIT;/* maximum error (us) */
> +long time_esterror = NTP_PHASE_LIMIT;/* estimated error (us) */
> +static s64 time_freq; /* frequency offset (scaled ns/s)*/
> +static long time_reftime; /* time at last adjustment (s) */
> +long time_adjust;
> +static long ntp_tick_adj;

I must say I really hate this kind of formating, it either gets out of
sync or requires reformatting. I would very strongly prefer not to
introduce this sort of formatting here.

> +static inline u64 scale_tickadj(u64 adj)
> +{
> + return ((adj * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ;
> +}

The function argument is actually s32 and depending on NTP_INTERVAL_FREQ
it might produce a link error on 32bit archs.

bye, Roman
--
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/