提交 796c1efd 编写于 作者: R Richard Cochran 提交者: David S. Miller

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: NJanusz Użycki <j.uzycki@elproma.com.pl>
Signed-off-by: NRichard Cochran <richardcochran@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 74d23cc7
...@@ -78,6 +78,15 @@ static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc, ...@@ -78,6 +78,15 @@ static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc,
return ret; return ret;
} }
/**
* 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 * timecounter_init - initialize a time counter
* @tc: Pointer to time counter which is to be initialized/reset * @tc: Pointer to time counter which is to be initialized/reset
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册