linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: y2038@lists.linaro.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Randy Dunlap <rdunlap@infradead.org>,
	"Gustavo A. R. Silva" <garsilva@embeddedor.com>,
	Matt Fornero <matt.fornero@mathworks.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: use timespec64 based interfaces for iio_get_time_ns()
Date: Sun, 24 Jun 2018 14:41:14 +0100	[thread overview]
Message-ID: <20180624144114.1b9887e4@archlinux> (raw)
In-Reply-To: <20180618153153.1903178-1-arnd@arndb.de>

On Mon, 18 Jun 2018 17:31:36 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> We have replacements for all the deprecated timespec based interfaces now,
> so this can finally convert iio_get_time_ns() to consistently use the
> nanosecond or timespec64 based interfaces instead, avoiding the y2038
> overflow.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Great!

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to sanity check.

Thanks

Jonathan

> ---
>  drivers/iio/industrialio-core.c | 26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 19bdf3d2962a..fcbe92c34a3d 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -207,35 +207,27 @@ static int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id)
>   */
>  s64 iio_get_time_ns(const struct iio_dev *indio_dev)
>  {
> -	struct timespec tp;
> +	struct timespec64 tp;
>  
>  	switch (iio_device_get_clock(indio_dev)) {
>  	case CLOCK_REALTIME:
> -		ktime_get_real_ts(&tp);
> -		break;
> +		return ktime_get_real_ns();
>  	case CLOCK_MONOTONIC:
> -		ktime_get_ts(&tp);
> -		break;
> +		return ktime_get_ns();
>  	case CLOCK_MONOTONIC_RAW:
> -		getrawmonotonic(&tp);
> -		break;
> +		return ktime_get_raw_ns();
>  	case CLOCK_REALTIME_COARSE:
> -		tp = current_kernel_time();
> -		break;
> +		return ktime_to_ns(ktime_get_coarse_real());
>  	case CLOCK_MONOTONIC_COARSE:
> -		tp = get_monotonic_coarse();
> -		break;
> +		ktime_get_coarse_ts64(&tp);
> +		return timespec64_to_ns(&tp);
>  	case CLOCK_BOOTTIME:
> -		get_monotonic_boottime(&tp);
> -		break;
> +		return ktime_get_boot_ns();
>  	case CLOCK_TAI:
> -		timekeeping_clocktai(&tp);
> -		break;
> +		return ktime_get_tai_ns();
>  	default:
>  		BUG();
>  	}
> -
> -	return timespec_to_ns(&tp);
>  }
>  EXPORT_SYMBOL(iio_get_time_ns);
>  


      reply	other threads:[~2018-06-24 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 15:31 [PATCH] iio: use timespec64 based interfaces for iio_get_time_ns() Arnd Bergmann
2018-06-24 13:41 ` Jonathan Cameron [this message]

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=20180624144114.1b9887e4@archlinux \
    --to=jic23@kernel.org \
    --cc=arnd@arndb.de \
    --cc=garsilva@embeddedor.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fornero@mathworks.com \
    --cc=pmeerw@pmeerw.net \
    --cc=rdunlap@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).