summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2015-01-02 20:22:03 +0100
committerDavid S. Miller <davem@davemloft.net>2015-01-02 22:47:35 +0100
commit1891172aa5c32f08ad9931b794edd71e91a4a527 (patch)
tree176a1a02d34babe34a377d6fb5fd50a78cca3e68 /include
parentMAINTAINERS: Update Open vSwitch entry. (diff)
downloadlinux-1891172aa5c32f08ad9931b794edd71e91a4a527.tar.xz
linux-1891172aa5c32f08ad9931b794edd71e91a4a527.zip
timecounter: provide a macro to initialize the cyclecounter mask field.
There is no need for users of the timecounter/cyclecounter code to include clocksource.h just for a single macro. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/timecounter.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/timecounter.h b/include/linux/timecounter.h
index 74f45496e6d1..4382035a75bb 100644
--- a/include/linux/timecounter.h
+++ b/include/linux/timecounter.h
@@ -19,6 +19,9 @@
#include <linux/types.h>
+/* simplify initialization of mask field */
+#define CYCLECOUNTER_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
+
/**
* struct cyclecounter - hardware abstraction for a free running counter
* Provides completely state-free accessors to the underlying hardware.
@@ -29,7 +32,7 @@
* @read: returns the current cycle value
* @mask: bitmask for two's complement
* subtraction of non 64 bit counters,
- * see CLOCKSOURCE_MASK() helper macro
+ * see CYCLECOUNTER_MASK() helper macro
* @mult: cycle to nanosecond multiplier
* @shift: cycle to nanosecond divisor (power of two)
*/