mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>,
	y2038@lists.linaro.org, Jordan Crouse <jcrouse@codeaurora.org>,
	Sean Paul <seanpaul@chromium.org>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/msm: avoid using 'timespec'
Date: Tue, 10 Jul 2018 16:47:36 -0400	[thread overview]
Message-ID: <20180710204736.GU20303@art_vandelay> (raw)
In-Reply-To: <20180618153959.2169325-1-arnd@arndb.de>

On Mon, Jun 18, 2018 at 05:39:42PM +0200, Arnd Bergmann wrote:
> The timespec structure and associated interfaces are deprecated and will
> be removed in the future because of the y2038 overflow.
> 
> The use of ktime_to_timespec() in timeout_to_jiffies() does not
> suffer from that overflow, but is easy to avoid by just converting
> the ktime_t into jiffies directly.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/msm/msm_drv.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index b2da1fbf81e0..cc8977476a41 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
>  		remaining_jiffies = 0;
>  	} else {
>  		ktime_t rem = ktime_sub(*timeout, now);
> -		struct timespec ts = ktime_to_timespec(rem);
> -		remaining_jiffies = timespec_to_jiffies(&ts);
> +		remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);

Do you need to wrap rem in ktime_to_ns() just to be safe?

Sean

>  	}
>  
>  	return remaining_jiffies;
> -- 
> 2.9.0
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

  reply	other threads:[~2018-07-10 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 15:39 Arnd Bergmann
2018-07-10 20:47 ` Sean Paul [this message]
2018-07-10 21:27   ` Arnd Bergmann
2018-07-11 14:00     ` Sean Paul

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=20180710204736.GU20303@art_vandelay \
    --to=seanpaul@chromium.org \
    --cc=airlied@linux.ie \
    --cc=arnd@arndb.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jcrouse@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=y2038@lists.linaro.org \
    /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

Powered by JetHome