Re: [PATCH 2/2] MIPS: Convert update_persistent_clock() to update_persistent_clock64()

From: Arnd Bergmann
Date: Thu May 03 2018 - 18:31:40 EST


On Wed, May 2, 2018 at 10:53 PM, Baolin Wang <baolin.wang@xxxxxxxxxx> wrote:
> diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
> index 17d4cd2..c4e2a1a 100644
> --- a/arch/mips/include/asm/time.h
> +++ b/arch/mips/include/asm/time.h
> @@ -27,8 +27,8 @@
> * rtc_mips_set_mmss - similar to rtc_set_time, but only min and sec need
> * to be set. Used by RTC sync-up.
> */
> -extern int rtc_mips_set_time(unsigned long);
> -extern int rtc_mips_set_mmss(unsigned long);
> +extern int rtc_mips_set_time(time64_t);
> +extern int rtc_mips_set_mmss(time64_t);
>

I think these should just get removed, and each implementation replaced
with a direct update_persistent_clock64() function.

> -int update_persistent_clock(struct timespec now)
> +int update_persistent_clock64(struct timespec64 now)
> {
> return rtc_mips_set_mmss(now.tv_sec);
> }

And this one also removed

> @@ -69,7 +69,7 @@ int proc_dolasatrtc(struct ctl_table *table, int write,
> if (rtctmp < 0)
> rtctmp = 0;
> }
> - r = proc_dointvec(table, write, buffer, lenp, ppos);
> + r = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
> if (r)
> return r;
>
> @@ -224,7 +224,7 @@ int proc_lasat_prid(struct ctl_table *table, int write,
> {
> .procname = "rtc",
> .data = &rtctmp,
> - .maxlen = sizeof(int),
> + .maxlen = sizeof(time64_t),
> .mode = 0644,
> .proc_handler = proc_dolasatrtc,
> },

Something seems wrong here: time64_t is not the same as 'unsigned long',
and the 'rtctmp' variable is still 'unsigned int'. Not sure what the right fix
would be (we don't seem to have a sysctl helper for s64), but the change
here makes it worse.

Arnd