netdev.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>,
	Ariel Elior <ariel.elior@qlogic.com>,
	Carolyn Wyborny <carolyn.wyborny@intel.com>,
	David Miller <davem@davemloft.net>,
	Frank Li <Frank.Li@freescale.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	John Stultz <john.stultz@linaro.org>,
	Matthew Vick <matthew.vick@intel.com>,
	Miroslav Lichvar <mlichvar@redhat.com>,
	Mugunthan V N <mugunthanvnm@ti.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: [PATCH net-next 02/11] timecounter: provide a helper function to shift the time.
Date: Sun, 21 Dec 2014 19:46:57 +0100	[thread overview]
Message-ID: <cb154598f15dff99f244f957a0a5cac2f5512461.1418504889.git.richardcochran@gmail.com> (raw)
In-Reply-To: <cover.1418504883.git.richardcochran@gmail.com>

Some PTP Hardware Clock drivers use a struct timecounter to represent
their clock. To adjust the time by a given offset, these drivers all
perform a two step read/write of their timecounter. However, it is
better and simpler just to adjust the offset in one step. This patch
introduces a little routine to help drivers implement the adjtime
method.

Suggested-by: Janusz Użycki <j.uzycki@elproma.com.pl>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 include/linux/timecounter.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/timecounter.h b/include/linux/timecounter.h
index 146f07a..af3dfa4 100644
--- a/include/linux/timecounter.h
+++ b/include/linux/timecounter.h
@@ -79,6 +79,15 @@ static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc,
 }
 
 /**
+ * timecounter_adjtime - Shifts the time of the clock.
+ * @delta:	Desired change in nanoseconds.
+ */
+static inline void timecounter_adjtime(struct timecounter *tc, s64 delta)
+{
+	tc->nsec += delta;
+}
+
+/**
  * timecounter_init - initialize a time counter
  * @tc:			Pointer to time counter which is to be initialized/reset
  * @cc:			A cycle counter, ready to be used.
-- 
1.7.10.4

  parent reply	other threads:[~2014-12-21 18:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21 18:46 [PATCH net-next 00/11] Time Counter fixes and improvements Richard Cochran
2014-12-21 18:46 ` [PATCH net-next 01/11] time: move the timecounter/cyclecounter code into its own file Richard Cochran
2014-12-23 21:03   ` Jeff Kirsher
2014-12-21 18:46 ` Richard Cochran [this message]
2014-12-21 18:46 ` [PATCH net-next 03/11] net: xgbe: convert to timecounter adjtime Richard Cochran
2014-12-21 18:46 ` [PATCH net-next 04/11] net: bnx2x: " Richard Cochran
2014-12-21 19:01   ` Richard Cochran
2014-12-21 18:47 ` [PATCH net-next 05/11] net: fec: " Richard Cochran
2014-12-21 18:47 ` [PATCH net-next 06/11] net: e1000e: " Richard Cochran
2014-12-23 21:04   ` Jeff Kirsher
2014-12-21 18:47 ` [PATCH net-next 07/11] net: igb: " Richard Cochran
2014-12-23 21:04   ` Jeff Kirsher
2014-12-21 18:47 ` [PATCH net-next 08/11] net: ixgbe: " Richard Cochran
2014-12-23 21:07   ` Jeff Kirsher
2014-12-23 21:42     ` Richard Cochran
2014-12-21 18:47 ` [PATCH net-next 09/11] net: mlx4: " Richard Cochran
2014-12-21 18:47 ` [PATCH net-next 10/11] net: cpts: " Richard Cochran
2014-12-21 18:47 ` [PATCH net-next 11/11] timecounter: keep track of accumulated fractional nanoseconds Richard Cochran
2014-12-30 23:32 ` [PATCH net-next 00/11] Time Counter fixes and improvements David Miller
2014-12-31 17:42   ` Richard Cochran
2015-01-02 18:37 ` John Stultz
2015-01-02 18:49   ` Richard Cochran

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=cb154598f15dff99f244f957a0a5cac2f5512461.1418504889.git.richardcochran@gmail.com \
    --to=richardcochran@gmail.com \
    --cc=Frank.Li@freescale.com \
    --cc=amirv@mellanox.com \
    --cc=ariel.elior@qlogic.com \
    --cc=carolyn.wyborny@intel.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.vick@intel.com \
    --cc=mlichvar@redhat.com \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.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).