aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/mmtimer.c10
-rw-r--r--kernel/posix-timers.c17
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 262d10453cb8..141ffaeb976c 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -53,6 +53,8 @@ MODULE_LICENSE("GPL");
53 53
54#define RTC_BITS 55 /* 55 bits for this implementation */ 54#define RTC_BITS 55 /* 55 bits for this implementation */
55 55
56static struct k_clock sgi_clock;
57
56extern unsigned long sn_rtc_cycles_per_second; 58extern unsigned long sn_rtc_cycles_per_second;
57 59
58#define RTC_COUNTER_ADDR ((long *)LOCAL_MMR_ADDR(SH_RTC)) 60#define RTC_COUNTER_ADDR ((long *)LOCAL_MMR_ADDR(SH_RTC))
@@ -763,10 +765,18 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
763 return err; 765 return err;
764} 766}
765 767
768static int sgi_clock_getres(const clockid_t which_clock, struct timespec *tp)
769{
770 tp->tv_sec = 0;
771 tp->tv_nsec = sgi_clock.res;
772 return 0;
773}
774
766static struct k_clock sgi_clock = { 775static struct k_clock sgi_clock = {
767 .res = 0, 776 .res = 0,
768 .clock_set = sgi_clock_set, 777 .clock_set = sgi_clock_set,
769 .clock_get = sgi_clock_get, 778 .clock_get = sgi_clock_get,
779 .clock_getres = sgi_clock_getres,
770 .timer_create = sgi_timer_create, 780 .timer_create = sgi_timer_create,
771 .timer_set = sgi_timer_set, 781 .timer_set = sgi_timer_set,
772 .timer_del = sgi_timer_del, 782 .timer_del = sgi_timer_del,
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 7f66143d1ce5..748497fffd0f 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -182,14 +182,6 @@ static inline void unlock_timer(struct k_itimer *timr, unsigned long flags)
182 * the function pointer CALL in struct k_clock. 182 * the function pointer CALL in struct k_clock.
183 */ 183 */
184 184
185static inline int common_clock_getres(const clockid_t which_clock,
186 struct timespec *tp)
187{
188 tp->tv_sec = 0;
189 tp->tv_nsec = posix_clocks[which_clock].res;
190 return 0;
191}
192
193static int common_timer_create(struct k_itimer *new_timer) 185static int common_timer_create(struct k_itimer *new_timer)
194{ 186{
195 hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0); 187 hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0);
@@ -984,18 +976,17 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
984SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, 976SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
985 struct timespec __user *, tp) 977 struct timespec __user *, tp)
986{ 978{
979 struct k_clock *kc = clockid_to_kclock(which_clock);
987 struct timespec rtn_tp; 980 struct timespec rtn_tp;
988 int error; 981 int error;
989 982
990 if (invalid_clockid(which_clock)) 983 if (!kc)
991 return -EINVAL; 984 return -EINVAL;
992 985
993 error = CLOCK_DISPATCH(which_clock, clock_getres, 986 error = kc->clock_getres(which_clock, &rtn_tp);
994 (which_clock, &rtn_tp));
995 987
996 if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) { 988 if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp)))
997 error = -EFAULT; 989 error = -EFAULT;
998 }
999 990
1000 return error; 991 return error;
1001} 992}