On Saturday 11 April 2015 18:46:53 Baolin Wang wrote:
This patch introduces the 64bit methods for k_clock structure, that converts the timespec type to timespec64 type.
Signed-off-by: Baolin Wang baolin.wang@linaro.org
kernel/time/posix-clock.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-)
Looks good.
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c index 382bf23..f425caf 100644 --- a/kernel/time/posix-clock.c +++ b/kernel/time/posix-clock.c @@ -297,20 +297,18 @@ out: return err; } -static int pc_clock_gettime(clockid_t id, struct timespec *ts) +static int pc_clock_gettime(clockid_t id, struct timespec64 *ts) { struct posix_clock_desc cd;
- struct timespec64 *tp; int err;
err = get_clock_desc(id, &cd); if (err) return err;
- if (cd.clk->ops.clock_gettime) {
*tp = timespec_to_timespec64(*ts);
err = cd.clk->ops.clock_gettime(cd.clk, tp);
- } else
- if (cd.clk->ops.clock_gettime)
err = cd.clk->ops.clock_gettime(cd.clk, ts);
- else err = -EOPNOTSUPP;
put_clock_desc(&cd); @@ -318,20 +316,18 @@ static int pc_clock_gettime(clockid_t id, struct timespec *ts) return err; } -static int pc_clock_getres(clockid_t id, struct timespec *ts) +static int pc_clock_getres(clockid_t id, struct timespec64 *ts) { struct posix_clock_desc cd;
- struct timespec64 *tp; int err;
err = get_clock_desc(id, &cd); if (err) return err;
- if (cd.clk->ops.clock_getres) {
*tp = timespec_to_timespec64(*ts);
err = cd.clk->ops.clock_getres(cd.clk, tp);
- } else
- if (cd.clk->ops.clock_getres)
err = cd.clk->ops.clock_getres(cd.clk, ts);
- else err = -EOPNOTSUPP;
put_clock_desc(&cd); @@ -339,10 +335,9 @@ static int pc_clock_getres(clockid_t id, struct timespec *ts) return err; } -static int pc_clock_settime(clockid_t id, const struct timespec *ts) +static int pc_clock_settime(clockid_t id, const struct timespec64 *ts) { struct posix_clock_desc cd;
- struct timespec64 tp; int err;
err = get_clock_desc(id, &cd); @@ -354,10 +349,9 @@ static int pc_clock_settime(clockid_t id, const struct timespec *ts) goto out; }
- if (cd.clk->ops.clock_settime) {
tp = timespec_to_timespec64(*ts);
err = cd.clk->ops.clock_settime(cd.clk, &tp);
- } else
- if (cd.clk->ops.clock_settime)
err = cd.clk->ops.clock_settime(cd.clk, ts);
- else err = -EOPNOTSUPP;
out: put_clock_desc(&cd); @@ -441,9 +435,9 @@ static int pc_timer_settime(struct k_itimer *kit, int flags, } struct k_clock clock_posix_dynamic = {
- .clock_getres = pc_clock_getres,
- .clock_set = pc_clock_settime,
- .clock_get = pc_clock_gettime,
- .clock_getres64 = pc_clock_getres,
- .clock_set64 = pc_clock_settime,
- .clock_get64 = pc_clock_gettime, .clock_adj = pc_clock_adjtime, .timer_create = pc_timer_create, .timer_set = pc_timer_settime,