backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: Luca Coelho <luca@coelho.fi>, backports@vger.kernel.org
Cc: Luca Coelho <luciano.coelho@intel.com>
Subject: Re: [PATCH] backport: add ktime_get_raw_ts64() backport for < 3.19
Date: Sun, 23 Sep 2018 15:52:42 +0200	[thread overview]
Message-ID: <4cb197ca-9ae6-18b9-ec7a-59eb893d96dd@hauke-m.de> (raw)
In-Reply-To: <20180920162622.30203-1-luca@coelho.fi>


[-- Attachment #1.1: Type: text/plain, Size: 1739 bytes --]

On 09/20/2018 06:26 PM, Luca Coelho wrote:
> From: Luca Coelho <luciano.coelho@intel.com>
> 
> The getrawmonotonic64() function that is used by the
> ktime_get_raw_ts64() backport was only introduced in 3.19.  To fix
> compilation with earlier kernels, do the convertion from
> getrawmonotonic() manually if the kernel is < 3.19.
> 
> Additionally, add timespec_to_timespec64() that we need for this
> conversion (and which was only introduced in 4.15).
> 
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> ---
>  backport/backport-include/linux/timekeeping.h | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h
> index aebb00ca366b..56fca5759b8e 100644
> --- a/backport/backport-include/linux/timekeeping.h
> +++ b/backport/backport-include/linux/timekeeping.h
> @@ -55,11 +55,40 @@ static inline void ktime_get_ts64(struct timespec64 *ts)
>  }
>  #endif
>  
> +#if LINUX_VERSION_IS_LESS(3,19,0)
> +/* This was introduced in 4.15, but we only need it in the
> + * ktime_get_raw_ts64 backport() for < 3.19.

timespec_to_timespec64() was already added in 3.17, see
https://elixir.bootlin.com/linux/v3.17.8/ident/timespec_to_timespec64

> + */
> +#if __BITS_PER_LONG == 64
> +static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
> +{
> +	return *(const struct timespec64 *)&ts;
> +}
> +
> +#else
> +static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
> +{
> +	struct timespec64 ret;
> +
> +	ret.tv_sec = ts.tv_sec;
> +	ret.tv_nsec = ts.tv_nsec;
> +	return ret;
> +}
> +#endif
> +#endif /* < 3.19 */
> +


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-09-23 19:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 16:26 [PATCH] backport: add ktime_get_raw_ts64() backport for < 3.19 Luca Coelho
2018-09-23 13:52 ` Hauke Mehrtens [this message]
2018-09-24  8:44   ` Luca Coelho
2018-09-24  8:57     ` [PATCH v2] " Luca Coelho

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=4cb197ca-9ae6-18b9-ec7a-59eb893d96dd@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    --cc=luca@coelho.fi \
    --cc=luciano.coelho@intel.com \
    /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).