diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2009-02-12 05:03:34 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-15 22:43:31 -0800 |
commit | a038a353c3de4040d8445ec568acebdac144436f (patch) | |
tree | 2fac74d812b47fa2d9fabfa55261d544813b66f6 /kernel/cpu.c | |
parent | 0a834a36ac92375cd82d9e4fe4f571e257997d6a (diff) |
clocksource: allow usage independent of timekeeping.c
So far struct clocksource acted as the interface between time/timekeeping.c
and hardware. This patch generalizes the concept so that a similar
interface can also be used in other contexts. For that it introduces
new structures and related functions *without* touching the existing
struct clocksource.
The reasons for adding these new structures to clocksource.[ch] are
* the APIs are clearly related
* struct clocksource could be cleaned up to use the new structs
* avoids proliferation of files with similar names (timesource.h?
timecounter.h?)
As outlined in the discussion with John Stultz, this patch adds
* struct cyclecounter: stateless API to hardware which counts clock cycles
* struct timecounter: stateful utility code built on a cyclecounter which
provides a nanosecond counter
* only the function to read the nanosecond counter; deltas are used internally
and not exposed to users of timecounter
The code does no locking of the shared state. It must be called at least
as often as the cycle counter wraps around to detect these wrap arounds.
Both is the responsibility of the timecounter user.
Acked-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/cpu.c')
0 files changed, 0 insertions, 0 deletions