From: Richard Cochran <richardcochran@gmail.com>
To: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, Amir Vadai <amirv@mellanox.com>,
Arnd Bergmann <arnd@linaro.org>,
Baolin Wang <baolin.wang@linaro.org>,
David Miller <davem@davemloft.net>,
Frank Li <Frank.Li@freescale.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
John Stultz <john.stultz@linaro.org>,
Luwei Zhou <b45643@freescale.com>,
Matthew Vick <matthew.vick@intel.com>,
Michael Chan <mchan@broadcom.com>,
Prashant Sreedharan <prashant@broadcom.com>,
Rayagond K <rayagond@vayavyalabs.com>,
Sonic Zhang <sonic.zhang@analog.com>,
Sony Chacko <sony.chacko@qlogic.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH net-next 05/11] ptp: gianfar: use helpers for converting ns to timespec.
Date: Tue, 31 Mar 2015 23:08:10 +0200 [thread overview]
Message-ID: <6b1438a86975f35c2f072a6908f2a66c20117fc3.1427835485.git.richardcochran@gmail.com> (raw)
In-Reply-To: <cover.1427835485.git.richardcochran@gmail.com>
This patch changes the driver to use ns_to_timespec64() and
timespec64_to_ns() instead of open coding the same logic.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/freescale/gianfar_ptp.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index 04265a7..8e3cd77 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -326,7 +326,6 @@ static int ptp_gianfar_gettime(struct ptp_clock_info *ptp,
struct timespec64 *ts)
{
u64 ns;
- u32 remainder;
unsigned long flags;
struct etsects *etsects = container_of(ptp, struct etsects, caps);
@@ -336,8 +335,8 @@ static int ptp_gianfar_gettime(struct ptp_clock_info *ptp,
spin_unlock_irqrestore(&etsects->lock, flags);
- ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder);
- ts->tv_nsec = remainder;
+ *ts = ns_to_timespec64(ns);
+
return 0;
}
@@ -348,8 +347,7 @@ static int ptp_gianfar_settime(struct ptp_clock_info *ptp,
unsigned long flags;
struct etsects *etsects = container_of(ptp, struct etsects, caps);
- ns = ts->tv_sec * 1000000000ULL;
- ns += ts->tv_nsec;
+ ns = timespec64_to_ns(ts);
spin_lock_irqsave(&etsects->lock, flags);
--
1.7.10.4
next prev parent reply other threads:[~2015-03-31 21:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 21:08 [PATCH net-next 00/11] remove open coded ns_to_timespec64 and reverse Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 01/11] ptp: blackfin: use helpers for converting ns to timespec Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 02/11] ptp: bnx2x: " Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 03/11] ptp: tg3: " Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 04/11] ptp: fec: " Richard Cochran
2015-03-31 21:08 ` Richard Cochran [this message]
2015-03-31 21:08 ` [PATCH net-next 06/11] ptp: e1000e: " Richard Cochran
2015-03-31 21:10 ` Keller, Jacob E
2015-03-31 21:08 ` [PATCH net-next 07/11] ptp: igb: " Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 08/11] ptp: ixgbe: " Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 09/11] ptp: mlx4: " Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 10/11] ptp: stmmac: " Richard Cochran
2015-03-31 21:08 ` [PATCH net-next 11/11] ptp: cpts: " Richard Cochran
2015-03-31 21:11 ` [PATCH net-next 00/11] remove open coded ns_to_timespec64 and reverse Keller, Jacob E
2015-03-31 21:38 ` Richard Cochran
2015-03-31 21:19 ` David Miller
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=6b1438a86975f35c2f072a6908f2a66c20117fc3.1427835485.git.richardcochran@gmail.com \
--to=richardcochran@gmail.com \
--cc=Frank.Li@freescale.com \
--cc=amirv@mellanox.com \
--cc=arnd@linaro.org \
--cc=b45643@freescale.com \
--cc=baolin.wang@linaro.org \
--cc=davem@davemloft.net \
--cc=jacob.e.keller@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.vick@intel.com \
--cc=mchan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=prashant@broadcom.com \
--cc=rayagond@vayavyalabs.com \
--cc=sonic.zhang@analog.com \
--cc=sony.chacko@qlogic.com \
--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).