lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 21 Dec 2014 19:46:57 +0100
From:	Richard Cochran <richardcochran@...il.com>
To:	<netdev@...r.kernel.org>
Cc:	<linux-kernel@...r.kernel.org>, Amir Vadai <amirv@...lanox.com>,
	Ariel Elior <ariel.elior@...gic.com>,
	Carolyn Wyborny <carolyn.wyborny@...el.com>,
	David Miller <davem@...emloft.net>,
	Frank Li <Frank.Li@...escale.com>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	John Stultz <john.stultz@...aro.org>,
	Matthew Vick <matthew.vick@...el.com>,
	Miroslav Lichvar <mlichvar@...hat.com>,
	Mugunthan V N <mugunthanvnm@...com>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Tom Lendacky <thomas.lendacky@....com>
Subject: [PATCH net-next 02/11] timecounter: provide a helper function to shift the time.

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@...roma.com.pl>
Signed-off-by: Richard Cochran <richardcochran@...il.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ