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 08/11] ptp: ixgbe: use helpers for converting ns to timespec.
Date: Tue, 31 Mar 2015 23:08:13 +0200 [thread overview]
Message-ID: <f7b4f8ac0c134cf49f635ecf10b96d8d46789288.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.
Compile tested only.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 75b9e93..e5ba040 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -284,15 +284,13 @@ static int ixgbe_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
struct ixgbe_adapter *adapter =
container_of(ptp, struct ixgbe_adapter, ptp_caps);
u64 ns;
- u32 remainder;
unsigned long flags;
spin_lock_irqsave(&adapter->tmreg_lock, flags);
ns = timecounter_read(&adapter->tc);
spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
- ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder);
- ts->tv_nsec = remainder;
+ *ts = ns_to_timespec64(ns);
return 0;
}
@@ -313,8 +311,7 @@ static int ixgbe_ptp_settime(struct ptp_clock_info *ptp,
u64 ns;
unsigned long flags;
- ns = ts->tv_sec * 1000000000ULL;
- ns += ts->tv_nsec;
+ ns = timespec64_to_ns(ts);
/* reset the timecounter */
spin_lock_irqsave(&adapter->tmreg_lock, flags);
--
1.7.10.4
next prev parent reply other threads:[~2015-03-31 21:11 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 ` [PATCH net-next 05/11] ptp: gianfar: " Richard Cochran
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 ` Richard Cochran [this message]
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=f7b4f8ac0c134cf49f635ecf10b96d8d46789288.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).