From: Hauke Mehrtens <hauke@hauke-m.de>
To: Stefan Assmann <sassmann@kpanic.de>, backports@vger.kernel.org
Cc: mcgrof@do-not-panic.com
Subject: Re: [PATCH 3/4] backports: deal with struct timespec64 changes
Date: Thu, 23 Apr 2015 22:10:09 +0200 [thread overview]
Message-ID: <553951A1.3070108@hauke-m.de> (raw)
In-Reply-To: <1429788825-18466-4-git-send-email-sassmann@kpanic.de>
On 04/23/2015 01:33 PM, Stefan Assmann wrote:
> igb now makes use of struct timespec64. Deal with the required
> changes via cocci patches where possible. There's one occasion
> where coccinelle is not able to deal with defining a struct and
> assigning another struct on the same line.
> Example:
> struct timespec64 now, then = ns_to_timespec64(delta);
> Deal with this in a separate patch for now.
I think it would be easier if you just replace timespec64 with timespec
in the header files.
Like:
#define ns_to_timespec64 ns_to_timespec
#define timespec64 timespec
Then cocci is only needed to replace the settime64 members with settime
and so on.
> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> ---
> .../network/0057-timespec64/INFO | 11 +++
> .../network/0057-timespec64/igb.patch | 16 +++++
> .../network/0057-timespec64/timespec64.cocci | 83 ++++++++++++++++++++++
> 3 files changed, 110 insertions(+)
> create mode 100644 patches/collateral-evolutions/network/0057-timespec64/INFO
> create mode 100644 patches/collateral-evolutions/network/0057-timespec64/igb.patch
> create mode 100644 patches/collateral-evolutions/network/0057-timespec64/timespec64.cocci
>
> diff --git a/patches/collateral-evolutions/network/0057-timespec64/INFO b/patches/collateral-evolutions/network/0057-timespec64/INFO
> new file mode 100644
> index 0000000..681c1df
> --- /dev/null
> +++ b/patches/collateral-evolutions/network/0057-timespec64/INFO
> @@ -0,0 +1,11 @@
> +In kernel 3.17 struct timespec64 was introduced.
> +Address this with cocci patches where possible.
> +
> +commit 361a3bf00582469877f8d18ff20f1efa6b781274
> +Author: John Stultz <john.stultz@linaro.org>
> +Date: Wed Jul 16 21:03:58 2014 +0000
> +
> + time64: Add time64.h header and define struct timespec64
> +
> +git describe --contains 361a3bf00582469877f8d18ff20f1efa6b781274
> +v3.17-rc1~109^2~62
> diff --git a/patches/collateral-evolutions/network/0057-timespec64/igb.patch b/patches/collateral-evolutions/network/0057-timespec64/igb.patch
> new file mode 100644
> index 0000000..559199f
> --- /dev/null
> +++ b/patches/collateral-evolutions/network/0057-timespec64/igb.patch
> @@ -0,0 +1,16 @@
> +diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> +index 060aa75..a660d39 100644
> +--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> ++++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> +@@ -285,7 +285,11 @@ static int igb_ptp_adjtime_i210(struct ptp_clock_info *ptp, s64 delta)
> + struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
> + ptp_caps);
> + unsigned long flags;
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + struct timespec64 now, then = ns_to_timespec64(delta);
> ++#else
> ++ struct timespec now, then = ns_to_timespec(delta);
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> +
> + spin_lock_irqsave(&igb->tmreg_lock, flags);
> +
> diff --git a/patches/collateral-evolutions/network/0057-timespec64/timespec64.cocci b/patches/collateral-evolutions/network/0057-timespec64/timespec64.cocci
> new file mode 100644
> index 0000000..4f568cb
> --- /dev/null
> +++ b/patches/collateral-evolutions/network/0057-timespec64/timespec64.cocci
> @@ -0,0 +1,83 @@
> +// ----------------------------------------------------------------------------
> +// handle struct timespec64 to timespec conversion in prototypes
> +@r1@
> +identifier func, I1;
> +@@
> + func(...
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + ,struct timespec64 *I1
> ++#else
> ++ ,struct timespec *I1
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> + ) {...}
> +
> +// ----------------------------------------------------------------------------
> +// handle struct timespec64 to timespec conversion in functions
> +@r2@
> +identifier I1;
> +@@
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + struct timespec64 I1;
> ++#else
> ++struct timespec I1;
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> +
> +// ----------------------------------------------------------------------------
> +// handle struct timespec64 to timespec conversion with assignment
> +@r3@
> +identifier I1;
> +expression E1;
> +@@
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + struct timespec64 I1 = E1;
> ++#else
> ++struct timespec I1 = E1;
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> +
> +// ----------------------------------------------------------------------------
> +// handle struct timespec64 to timespec casts
> +@r4@
> +identifier func;
> +expression E1, E2;
> +@@
> + func(E1
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + ,(const struct timespec64 *) E2
> ++#else
> ++ ,(const struct timespec *) E2
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> + );
> +
> +// ----------------------------------------------------------------------------
> +// handle timespec64_add to timespec_add function rename
> +@r5@
> +identifier I1;
> +expression E1, E2;
> +@@
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + I1 = timespec64_add(E1, E2);
> ++#else
> ++I1 = timespec_add(E1, E2);
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> +
> +// ----------------------------------------------------------------------------
> +// handle ns_to_timespec64 to ns_to_timespec function rename
> +@r6@
> +expression E1, E2;
> +@@
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + E1 = ns_to_timespec64(E2);
> ++#else
> ++E1 = ns_to_timespec(E2);
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
> +
> +// ----------------------------------------------------------------------------
> +// handle timespec64_to_ns to timespec_to_ns function rename
> +@r7@
> +expression E1, E2;
> +@@
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> + E1 = timespec64_to_ns(E2);
> ++#else
> ++E1 = timespec_to_ns(E2);
> ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) */
>
next prev parent reply other threads:[~2015-04-23 20:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 11:33 [PATCH 0/4] backports: deal with timespec64 changes Stefan Assmann
2015-04-23 11:33 ` [PATCH 1/4] backports: handle ndo_gso_check() to ndo_features_check() changes Stefan Assmann
2015-04-23 11:33 ` [PATCH 2/4] backports: add passthru_features_check() Stefan Assmann
2015-04-23 11:33 ` [PATCH 3/4] backports: deal with struct timespec64 changes Stefan Assmann
2015-04-23 20:10 ` Hauke Mehrtens [this message]
2015-04-24 15:05 ` Stefan Assmann
2015-04-23 11:33 ` [PATCH 4/4] backports: deal with struct struct ptp_clock_info get/settime64 changes Stefan Assmann
2015-04-25 14:00 ` [PATCH 0/4] backports: deal with timespec64 changes Hauke Mehrtens
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=553951A1.3070108@hauke-m.de \
--to=hauke@hauke-m.de \
--cc=backports@vger.kernel.org \
--cc=mcgrof@do-not-panic.com \
--cc=sassmann@kpanic.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