Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf64391c authored by Richard Cochran's avatar Richard Cochran Committed by Arve Hjønnevåg
Browse files

UPSTREAM: timecounter: provide a macro to initialize the cyclecounter mask field.



(cherry picked from commit 1891172aa5c32f08ad9931b794edd71e91a4a527)

There is no need for users of the timecounter/cyclecounter code to include
clocksource.h just for a single macro.

Change-Id: I809b7690502d3c1fe397903432f0299803522e89
Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2bafaab6
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -19,6 +19,9 @@


#include <linux/types.h>
#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
 * struct cyclecounter - hardware abstraction for a free running counter
 *	Provides completely state-free accessors to the underlying hardware.
 *	Provides completely state-free accessors to the underlying hardware.
@@ -29,7 +32,7 @@
 * @read:		returns the current cycle value
 * @read:		returns the current cycle value
 * @mask:		bitmask for two's complement
 * @mask:		bitmask for two's complement
 *			subtraction of non 64 bit counters,
 *			subtraction of non 64 bit counters,
 *			see CLOCKSOURCE_MASK() helper macro
 *			see CYCLECOUNTER_MASK() helper macro
 * @mult:		cycle to nanosecond multiplier
 * @mult:		cycle to nanosecond multiplier
 * @shift:		cycle to nanosecond divisor (power of two)
 * @shift:		cycle to nanosecond divisor (power of two)
 */
 */