lkml.org 
[lkml]   [2015]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 22/22] k_clock:Remove the 32bit methods with timespec/itimerspec type
Date
All of the k_clock users have been converted to the new 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@linaro.org>
---
include/linux/posix-timers.h | 9 -----
kernel/time/posix-timers.c | 74 +++---------------------------------------
2 files changed, 5 insertions(+), 78 deletions(-)

diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 9a5a211..2b47d04 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 a5bf0cf..845955f 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; \
@@ -514,57 +513,6 @@ static struct pid *good_sigevent(sigevent_t * event)
return task_pid(rtn);
}

-static int 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);
- return 0;
-}
-
-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;
-
- kc->timer_set(timr, flags, &new_setting, &old_setting);
- return 0;
-}
-
-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;
-
- kc->clock_set(which_clock, &tp);
- return 0;
-}
-
-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;
-
- kc->clock_get(which_clock, &tp);
- return 0;
-}
-
-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;
-
- kc->clock_getres(which_clock, &tp);
- return 0;
-}
-
void posix_timers_register_clock(const clockid_t clock_id,
struct k_clock *new_clock)
{
@@ -574,28 +522,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);
@@ -642,8 +579,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


\
 
 \ /
  Last update: 2015-05-11 13:41    [W:0.030 / U:20.592 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site