linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Miroslav Lichvar <mlichvar@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Prarit Bhargava <prarit@redhat.com>,
	Stephen Boyd <stephen.boyd@linaro.org>
Subject: Re: [PATCH 3/4] y2038: time: Introduce struct __kernel_old_timeval
Date: Wed, 14 Mar 2018 23:02:10 +0100	[thread overview]
Message-ID: <CAK8P3a1PGEk2WDQU8i7H64Cw4dmYaJ-6vPLzW_2o23PTgm74JA@mail.gmail.com> (raw)
In-Reply-To: <20180310081123.thin6wphgk7tongy@gmail.com>

On Sat, Mar 10, 2018 at 9:11 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
>> +extern struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec);
>
> Generally there's no need to mark arguments with arithmethic types as const, as
> they are never modified in the calling scope.

Sure. Here I just copied from the neighboring line, but that's an obvious
change.

>> + * legacy timeval structure, only embedded in structures that
>> + * traditionally used 'timeval' to pass time intervals (not absolute
>> + * times). Do not add new users. If user space fails to compile
>> + * here, this is probably because it is not y2038 safe and needs to
>> + * be changed to use another interface.
>> + */
>> +struct __kernel_old_timeval {
>> +     __kernel_long_t tv_sec;                 /* seconds */
>> +     __kernel_long_t tv_usec;                /* seconds */
>
> s/seconds/microseconds

Right.

>> +struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec)
>> +{
>> +     struct timespec64 ts = ns_to_timespec64(nsec);
>> +     struct __kernel_old_timeval tv;
>> +
>> +     tv.tv_sec = ts.tv_sec;
>> +     tv.tv_usec = (suseconds_t) ts.tv_nsec / 1000;
>
> Is ts.tv_nsec guaranteed to never have bits set in the high 32 bits?

Yes, ns_to_timespec64() produces a valid timespec64 structure.

> In any case, the space before the type cast is a bit confusing to me, I think it
> should be written as:
>
>         tv.tv_usec = (suseconds_t)ts.tv_nsec / 1000;
>
> To better show was the higher precedence of the cast is going to result in.

Sure.

Thanks for taking a look, I'll send an updated version.

       Arnd

  reply	other threads:[~2018-03-14 22:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 18:42 [GIT PULL][PATCH 0/4] Timekeeping queue for 4.17 John Stultz
2018-03-09 18:42 ` [PATCH 1/4] timekeeping: Don't align frequency adjustments to ticks John Stultz
2018-03-10  9:12   ` [tip:timers/core] timekeeping/ntp: Don't align NTP " tip-bot for Miroslav Lichvar
2018-03-09 18:42 ` [PATCH 2/4] timekeeping: Determine multiplier directly from NTP tick length John Stultz
2018-03-10  9:13   ` [tip:timers/core] timekeeping/ntp: Determine the " tip-bot for Miroslav Lichvar
2018-03-09 18:42 ` [PATCH 3/4] y2038: time: Introduce struct __kernel_old_timeval John Stultz
2018-03-10  8:11   ` Ingo Molnar
2018-03-14 22:02     ` Arnd Bergmann [this message]
2018-03-14 22:04       ` [PATCH] [v2] y2038: introduce " Arnd Bergmann
2018-03-15  8:44         ` Thomas Gleixner
2018-03-15 15:46           ` Arnd Bergmann
2018-03-09 18:42 ` [PATCH 4/4] x86: rtc: Stop using rtc deprecated functions John Stultz
2018-03-15  8:52   ` [tip:x86/cleanups] x86/rtc: Stop using " tip-bot for Benjamin Gaignard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a1PGEk2WDQU8i7H64Cw4dmYaJ-6vPLzW_2o23PTgm74JA@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=stephen.boyd@linaro.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).