linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 10/11] ptp: stmmac: use helpers for converting ns to timespec.
Date: Tue, 31 Mar 2015 23:08:15 +0200	[thread overview]
Message-ID: <93b0d362b29bf5ba1bc9c09b2e25e6958fb32511.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() instead of
open coding the same logic.

Compile tested only.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 172f318..170a18b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -111,7 +111,6 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
 	    container_of(ptp, struct stmmac_priv, ptp_clock_ops);
 	unsigned long flags;
 	u64 ns;
-	u32 reminder;
 
 	spin_lock_irqsave(&priv->ptp_lock, flags);
 
@@ -119,8 +118,7 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
 
 	spin_unlock_irqrestore(&priv->ptp_lock, flags);
 
-	ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &reminder);
-	ts->tv_nsec = reminder;
+	*ts = ns_to_timespec64(ns);
 
 	return 0;
 }
-- 
1.7.10.4


  parent reply	other threads:[~2015-03-31 21:10 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 ` [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 ` Richard Cochran [this message]
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=93b0d362b29bf5ba1bc9c09b2e25e6958fb32511.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).