Merge tag 'fortglx-3.20-time' of https://git.linaro.org/people/john.stultz/linux into timers/core
Pull time updates from John Stultz for 3.20: * ktime division optimization * Expose a few more y2038-safe timekeeping interfaces * RTC core changes to address y2038
This commit is contained in:
@@ -166,7 +166,17 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2)
|
||||
}
|
||||
|
||||
#if BITS_PER_LONG < 64
|
||||
extern u64 ktime_divns(const ktime_t kt, s64 div);
|
||||
extern u64 __ktime_divns(const ktime_t kt, s64 div);
|
||||
static inline u64 ktime_divns(const ktime_t kt, s64 div)
|
||||
{
|
||||
if (__builtin_constant_p(div) && !(div >> 32)) {
|
||||
u64 ns = kt.tv64;
|
||||
do_div(ns, div);
|
||||
return ns;
|
||||
} else {
|
||||
return __ktime_divns(kt, div);
|
||||
}
|
||||
}
|
||||
#else /* BITS_PER_LONG < 64 */
|
||||
# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
|
||||
#endif
|
||||
|
@@ -161,7 +161,7 @@ extern void devm_rtc_device_unregister(struct device *dev,
|
||||
extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
|
||||
extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
|
||||
extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
|
||||
extern int rtc_set_ntp_time(struct timespec now);
|
||||
extern int rtc_set_ntp_time(struct timespec64 now);
|
||||
int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
|
||||
extern int rtc_read_alarm(struct rtc_device *rtc,
|
||||
struct rtc_wkalrm *alrm);
|
||||
|
@@ -33,6 +33,7 @@ extern time64_t ktime_get_real_seconds(void);
|
||||
|
||||
extern int __getnstimeofday64(struct timespec64 *tv);
|
||||
extern void getnstimeofday64(struct timespec64 *tv);
|
||||
extern void getboottime64(struct timespec64 *ts);
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
/**
|
||||
@@ -72,6 +73,11 @@ static inline struct timespec get_monotonic_coarse(void)
|
||||
{
|
||||
return get_monotonic_coarse64();
|
||||
}
|
||||
|
||||
static inline void getboottime(struct timespec *ts)
|
||||
{
|
||||
return getboottime64(ts);
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* Deprecated. Use do_settimeofday64().
|
||||
@@ -129,9 +135,15 @@ static inline struct timespec get_monotonic_coarse(void)
|
||||
{
|
||||
return timespec64_to_timespec(get_monotonic_coarse64());
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void getboottime(struct timespec *ts);
|
||||
static inline void getboottime(struct timespec *ts)
|
||||
{
|
||||
struct timespec64 ts64;
|
||||
|
||||
getboottime64(&ts64);
|
||||
*ts = timespec64_to_timespec(ts64);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
|
||||
#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
|
||||
@@ -217,6 +229,11 @@ static inline void get_monotonic_boottime(struct timespec *ts)
|
||||
*ts = ktime_to_timespec(ktime_get_boottime());
|
||||
}
|
||||
|
||||
static inline void get_monotonic_boottime64(struct timespec64 *ts)
|
||||
{
|
||||
*ts = ktime_to_timespec64(ktime_get_boottime());
|
||||
}
|
||||
|
||||
static inline void timekeeping_clocktai(struct timespec *ts)
|
||||
{
|
||||
*ts = ktime_to_timespec(ktime_get_clocktai());
|
||||
|
Reference in New Issue
Block a user