[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <ff09498c3e9cd197e273f2f510dedc98e42842fe.1434079263.git.baolin.wang@linaro.org>
Date: Fri, 12 Jun 2015 16:12:58 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: tglx@...utronix.de
Cc: arnd@...db.de, linux-kernel@...r.kernel.org,
baolin.wang@...aro.org, y2038@...ts.linaro.org
Subject: [PATCH v5 24/24] k_clock: Remove y2038 unsafe callbacks
All of the k_clock users have been converted to the y2038 safe methods,
this patch removes the older methods with timepsec/itimerspec type,
as a result the k_clock structure is ready for the year 2038.
Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
include/linux/posix-timers.h | 9 -----
kernel/time/posix-timers.c | 90 +++---------------------------------------
2 files changed, 5 insertions(+), 94 deletions(-)
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 35786c5..7c3dae2 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -97,29 +97,20 @@ struct k_itimer {
};
struct k_clock {
- int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
int (*clock_getres64) (const clockid_t which_clock, struct timespec64 *tp);
- int (*clock_set) (const clockid_t which_clock,
- const struct timespec *tp);
int (*clock_set64) (const clockid_t which_clock,
const struct timespec64 *tp);
- int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
int (*clock_get64) (const clockid_t which_clock, struct timespec64 *tp);
int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
int (*timer_create) (struct k_itimer *timer);
int (*nsleep) (const clockid_t which_clock, int flags,
struct timespec *, struct timespec __user *);
long (*nsleep_restart) (struct restart_block *restart_block);
- int (*timer_set) (struct k_itimer * timr, int flags,
- struct itimerspec * new_setting,
- struct itimerspec * old_setting);
int (*timer_set64) (struct k_itimer *timr, int flags,
struct itimerspec64 *new_setting,
struct itimerspec64 *old_setting);
int (*timer_del) (struct k_itimer * timr);
#define TIMER_RETRY 1
- void (*timer_get) (struct k_itimer * timr,
- struct itimerspec * cur_setting);
void (*timer_get64) (struct k_itimer *timr,
struct itimerspec64 *cur_setting);
};
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 80f630a..e9e6e29 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -140,7 +140,6 @@ static int common_timer_del(struct k_itimer *timer);
static enum hrtimer_restart posix_timer_fn(struct hrtimer *data);
static struct k_itimer *__lock_timer(timer_t timer_id, unsigned long *flags);
-static struct k_clock *clockid_to_kclock(const clockid_t id);
#define lock_timer(tid, flags) \
({ struct k_itimer *__timr; \
@@ -550,73 +549,6 @@ static struct pid *good_sigevent(sigevent_t * event)
return task_pid(rtn);
}
-static void default_timer_get64(struct k_itimer *timr,
- struct itimerspec64 *cur_setting64)
-{
- struct itimerspec cur_setting;
- struct k_clock *kc = clockid_to_kclock(timr->it_clock);
-
- kc->timer_get(timr, &cur_setting);
- *cur_setting64 = itimerspec_to_itimerspec64(&cur_setting);
-}
-
-static int default_timer_set64(struct k_itimer *timr, int flags,
- struct itimerspec64 *new_setting64,
- struct itimerspec64 *old_setting64)
-{
- struct k_clock *kc = clockid_to_kclock(timr->it_clock);
- struct itimerspec new_setting, old_setting;
- struct itimerspec *rtn = old_setting64 ? &old_setting : NULL;
- int ret;
-
- new_setting = itimerspec64_to_itimerspec(new_setting64);
- ret = kc->timer_set(timr, flags, &new_setting, rtn);
- if (!ret && old_setting64)
- *old_setting64 = itimerspec_to_itimerspec64(&old_setting);
-
- return ret;
-}
-
-static int default_clock_set64(const clockid_t which_clock,
- const struct timespec64 *tp64)
-{
- struct k_clock *kc = clockid_to_kclock(which_clock);
- struct timespec tp;
- int ret;
-
- tp = timespec64_to_timespec(*tp64);
- ret = kc->clock_set(which_clock, &tp);
- return ret;
-}
-
-static int default_clock_get64(const clockid_t which_clock,
- struct timespec64 *tp64)
-{
- struct k_clock *kc = clockid_to_kclock(which_clock);
- struct timespec tp;
- int ret;
-
- ret = kc->clock_get(which_clock, &tp);
- if (!ret)
- *tp64 = timespec_to_timespec64(tp);
-
- return ret;
-}
-
-static int default_clock_getres64(const clockid_t which_clock,
- struct timespec64 *tp64)
-{
- struct k_clock *kc = clockid_to_kclock(which_clock);
- struct timespec tp;
- int ret;
-
- ret = kc->clock_getres(which_clock, &tp);
- if (!ret)
- *tp64 = timespec_to_timespec64(tp);
-
- return 0;
-}
-
void posix_timers_register_clock(const clockid_t clock_id,
struct k_clock *new_clock)
{
@@ -626,28 +558,17 @@ void posix_timers_register_clock(const clockid_t clock_id,
return;
}
- if (!new_clock->clock_get && !new_clock->clock_get64) {
- printk(KERN_WARNING "POSIX clock id %d lacks clock_get() and clock_get64()\n",
+ if (!new_clock->clock_get64) {
+ printk(KERN_WARNING "POSIX clock id %d lacks clock_get64()\n",
clock_id);
return;
}
- if (!new_clock->clock_getres && !new_clock->clock_getres64) {
- printk(KERN_WARNING "POSIX clock id %d lacks clock_getres() and clock_getres64()\n",
+ if (!new_clock->clock_getres64) {
+ printk(KERN_WARNING "POSIX clock id %d lacks clock_getres64()\n",
clock_id);
return;
}
- if (new_clock->timer_get && !new_clock->timer_get64)
- new_clock->timer_get64 = default_timer_get64;
- if (new_clock->timer_set && !new_clock->timer_set64)
- new_clock->timer_set64 = default_timer_set64;
- if (new_clock->clock_set && !new_clock->clock_set64)
- new_clock->clock_set64 = default_clock_set64;
- if (new_clock->clock_get && !new_clock->clock_get64)
- new_clock->clock_get64 = default_clock_get64;
- if (new_clock->clock_getres && !new_clock->clock_getres64)
- new_clock->clock_getres64 = default_clock_getres64;
-
posix_clocks[clock_id] = *new_clock;
}
EXPORT_SYMBOL_GPL(posix_timers_register_clock);
@@ -694,8 +615,7 @@ static struct k_clock *clockid_to_kclock(const clockid_t id)
return (id & CLOCKFD_MASK) == CLOCKFD ?
&clock_posix_dynamic : &clock_posix_cpu;
- if (id >= MAX_CLOCKS || (!posix_clocks[id].clock_getres
- && !posix_clocks[id].clock_getres64))
+ if (id >= MAX_CLOCKS || !posix_clocks[id].clock_getres64)
return NULL;
return &posix_clocks[id];
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists