hrtimer: Get rid of hrtimer_get_res()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 14 Apr 2015 21:08:32 +0000 (21:08 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 22 Apr 2015 15:06:49 +0000 (17:06 +0200)
The resolution is directly accessible now. So its simpler just to fill
in the values of the timespec and be done with it.

Text size reduction (combined with "hrtimer: Get rid of the resolution
field in hrtimer_clock_base"):
       x8664 -61, i386 -221, ARM -60, power64 -48

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20150414203500.879888080@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/hrtimer.h
kernel/time/alarmtimer.c
kernel/time/hrtimer.c
kernel/time/posix-timers.c

index bc6f91b5443badd775d8b25b8389b45f9f09abe6..8025156c8fa113e14c551e1f291818eddc6f6e30 100644 (file)
@@ -385,7 +385,6 @@ static inline int hrtimer_restart(struct hrtimer *timer)
 
 /* Query timers: */
 extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
-extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
 
 extern ktime_t hrtimer_get_next_event(void);
 
index 1b001ed1edb945cd5a95238fc563f93e8971041e..0b55a7570c9030f0d2428f114bbe791960856d83 100644 (file)
@@ -495,12 +495,12 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,
  */
 static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp)
 {
-       clockid_t baseid = alarm_bases[clock2alarm(which_clock)].base_clockid;
-
        if (!alarmtimer_get_rtcdev())
                return -EINVAL;
 
-       return hrtimer_get_res(baseid, tp);
+       tp->tv_sec = 0;
+       tp->tv_nsec = hrtimer_resolution;
+       return 0;
 }
 
 /**
index 965687a1fce60086935e79af41a5d7d20080c0e7..73131dab787e02acf0d474a0a18c59f05a6cb881 100644 (file)
@@ -1179,22 +1179,6 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
 }
 EXPORT_SYMBOL_GPL(hrtimer_init);
 
-/**
- * hrtimer_get_res - get the timer resolution for a clock
- * @which_clock: which clock to query
- * @tp:                 pointer to timespec variable to store the resolution
- *
- * Store the resolution of the clock selected by @which_clock in the
- * variable pointed to by @tp.
- */
-int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp)
-{
-       tp->tv_sec = 0;
-       tp->tv_nsec = hrtimer_resolution;
-       return 0;
-}
-EXPORT_SYMBOL_GPL(hrtimer_get_res);
-
 static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)
 {
        struct hrtimer_clock_base *base = timer->base;
index 31ea01f42e1f088786a291199cc54e9bde4658c9..31d11ac9fa4739789728c44470b82115ec307d11 100644 (file)
@@ -272,13 +272,20 @@ static int posix_get_tai(clockid_t which_clock, struct timespec *tp)
        return 0;
 }
 
+static int posix_get_hrtimer_res(clockid_t which_clock, struct timespec *tp)
+{
+       tp->tv_sec = 0;
+       tp->tv_nsec = hrtimer_resolution;
+       return 0;
+}
+
 /*
  * Initialize everything, well, just everything in Posix clocks/timers ;)
  */
 static __init int init_posix_timers(void)
 {
        struct k_clock clock_realtime = {
-               .clock_getres   = hrtimer_get_res,
+               .clock_getres   = posix_get_hrtimer_res,
                .clock_get      = posix_clock_realtime_get,
                .clock_set      = posix_clock_realtime_set,
                .clock_adj      = posix_clock_realtime_adj,
@@ -290,7 +297,7 @@ static __init int init_posix_timers(void)
                .timer_del      = common_timer_del,
        };
        struct k_clock clock_monotonic = {
-               .clock_getres   = hrtimer_get_res,
+               .clock_getres   = posix_get_hrtimer_res,
                .clock_get      = posix_ktime_get_ts,
                .nsleep         = common_nsleep,
                .nsleep_restart = hrtimer_nanosleep_restart,
@@ -300,7 +307,7 @@ static __init int init_posix_timers(void)
                .timer_del      = common_timer_del,
        };
        struct k_clock clock_monotonic_raw = {
-               .clock_getres   = hrtimer_get_res,
+               .clock_getres   = posix_get_hrtimer_res,
                .clock_get      = posix_get_monotonic_raw,
        };
        struct k_clock clock_realtime_coarse = {
@@ -312,7 +319,7 @@ static __init int init_posix_timers(void)
                .clock_get      = posix_get_monotonic_coarse,
        };
        struct k_clock clock_tai = {
-               .clock_getres   = hrtimer_get_res,
+               .clock_getres   = posix_get_hrtimer_res,
                .clock_get      = posix_get_tai,
                .nsleep         = common_nsleep,
                .nsleep_restart = hrtimer_nanosleep_restart,
@@ -322,7 +329,7 @@ static __init int init_posix_timers(void)
                .timer_del      = common_timer_del,
        };
        struct k_clock clock_boottime = {
-               .clock_getres   = hrtimer_get_res,
+               .clock_getres   = posix_get_hrtimer_res,
                .clock_get      = posix_get_boottime,
                .nsleep         = common_nsleep,
                .nsleep_restart = hrtimer_nanosleep_restart,