time: Provide get_xtime_and_monotonic_offset()
The hrtimer code accesses timekeeping variables under xtime_lock. Provide a sensible accessor function and use it. [ tglx: Removed the conditionals, unused variable, fixed codingstyle and massaged changelog ] Signed-off-by: Torben Hohn <torbenh@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: johnstul@us.ibm.com Cc: yong.zhang0@gmail.com Cc: hch@infradead.org LKML-Reference: <20110127145905.23248.30458.stgit@localhost> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:

committed by
Thomas Gleixner

parent
fbad1ea941
commit
48cf76f710
@@ -958,3 +958,19 @@ void do_timer(unsigned long ticks)
|
||||
update_wall_time();
|
||||
calc_global_load(ticks);
|
||||
}
|
||||
|
||||
/**
|
||||
* get_xtime_and_monotonic_offset() - get xtime and wall_to_monotonic
|
||||
* @xtim: pointer to timespec to be set with xtime
|
||||
* @wtom: pointer to timespec to be set with wall_to_monotonic
|
||||
*/
|
||||
void get_xtime_and_monotonic_offset(struct timespec *xtim, struct timespec *wtom)
|
||||
{
|
||||
unsigned long seq;
|
||||
|
||||
do {
|
||||
seq = read_seqbegin(&xtime_lock);
|
||||
*xtim = xtime;
|
||||
*wtom = wall_to_monotonic;
|
||||
} while (read_seqretry(&xtime_lock, seq));
|
||||
}
|
||||
|
Reference in New Issue
Block a user