Commit f2dec1ea authored by Thomas Gleixner's avatar Thomas Gleixner Committed by John Stultz

powerpc: cell: Use ktime_get_ns()

Replace the ever recurring:
	ts = ktime_get_ts();
	ns = timespec_to_ns(&ts);
with
	ns = ktime_get_ns();
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 68f6783d
...@@ -611,7 +611,6 @@ static int __init create_spu(void *data) ...@@ -611,7 +611,6 @@ static int __init create_spu(void *data)
int ret; int ret;
static int number; static int number;
unsigned long flags; unsigned long flags;
struct timespec ts;
ret = -ENOMEM; ret = -ENOMEM;
spu = kzalloc(sizeof (*spu), GFP_KERNEL); spu = kzalloc(sizeof (*spu), GFP_KERNEL);
...@@ -652,8 +651,7 @@ static int __init create_spu(void *data) ...@@ -652,8 +651,7 @@ static int __init create_spu(void *data)
mutex_unlock(&spu_full_list_mutex); mutex_unlock(&spu_full_list_mutex);
spu->stats.util_state = SPU_UTIL_IDLE_LOADED; spu->stats.util_state = SPU_UTIL_IDLE_LOADED;
ktime_get_ts(&ts); spu->stats.tstamp = ktime_get_ns();
spu->stats.tstamp = timespec_to_ns(&ts);
INIT_LIST_HEAD(&spu->aff_list); INIT_LIST_HEAD(&spu->aff_list);
...@@ -676,7 +674,6 @@ static const char *spu_state_names[] = { ...@@ -676,7 +674,6 @@ static const char *spu_state_names[] = {
static unsigned long long spu_acct_time(struct spu *spu, static unsigned long long spu_acct_time(struct spu *spu,
enum spu_utilization_state state) enum spu_utilization_state state)
{ {
struct timespec ts;
unsigned long long time = spu->stats.times[state]; unsigned long long time = spu->stats.times[state];
/* /*
...@@ -684,10 +681,8 @@ static unsigned long long spu_acct_time(struct spu *spu, ...@@ -684,10 +681,8 @@ static unsigned long long spu_acct_time(struct spu *spu,
* statistics are not updated. Apply the time delta from the * statistics are not updated. Apply the time delta from the
* last recorded state of the spu. * last recorded state of the spu.
*/ */
if (spu->stats.util_state == state) { if (spu->stats.util_state == state)
ktime_get_ts(&ts); time += ktime_get_ns() - spu->stats.tstamp;
time += timespec_to_ns(&ts) - spu->stats.tstamp;
}
return time / NSEC_PER_MSEC; return time / NSEC_PER_MSEC;
} }
......
...@@ -36,7 +36,6 @@ atomic_t nr_spu_contexts = ATOMIC_INIT(0); ...@@ -36,7 +36,6 @@ atomic_t nr_spu_contexts = ATOMIC_INIT(0);
struct spu_context *alloc_spu_context(struct spu_gang *gang) struct spu_context *alloc_spu_context(struct spu_gang *gang)
{ {
struct spu_context *ctx; struct spu_context *ctx;
struct timespec ts;
ctx = kzalloc(sizeof *ctx, GFP_KERNEL); ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx) if (!ctx)
...@@ -67,8 +66,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang) ...@@ -67,8 +66,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
__spu_update_sched_info(ctx); __spu_update_sched_info(ctx);
spu_set_timeslice(ctx); spu_set_timeslice(ctx);
ctx->stats.util_state = SPU_UTIL_IDLE_LOADED; ctx->stats.util_state = SPU_UTIL_IDLE_LOADED;
ktime_get_ts(&ts); ctx->stats.tstamp = ktime_get_ns();
ctx->stats.tstamp = timespec_to_ns(&ts);
atomic_inc(&nr_spu_contexts); atomic_inc(&nr_spu_contexts);
goto out; goto out;
......
...@@ -2338,7 +2338,6 @@ static const char *ctx_state_names[] = { ...@@ -2338,7 +2338,6 @@ static const char *ctx_state_names[] = {
static unsigned long long spufs_acct_time(struct spu_context *ctx, static unsigned long long spufs_acct_time(struct spu_context *ctx,
enum spu_utilization_state state) enum spu_utilization_state state)
{ {
struct timespec ts;
unsigned long long time = ctx->stats.times[state]; unsigned long long time = ctx->stats.times[state];
/* /*
...@@ -2351,8 +2350,7 @@ static unsigned long long spufs_acct_time(struct spu_context *ctx, ...@@ -2351,8 +2350,7 @@ static unsigned long long spufs_acct_time(struct spu_context *ctx,
* of the spu context. * of the spu context.
*/ */
if (ctx->spu && ctx->stats.util_state == state) { if (ctx->spu && ctx->stats.util_state == state) {
ktime_get_ts(&ts); time += ktime_get_ns() - ctx->stats.tstamp;
time += timespec_to_ns(&ts) - ctx->stats.tstamp;
} }
return time / NSEC_PER_MSEC; return time / NSEC_PER_MSEC;
......
...@@ -1039,13 +1039,11 @@ void spuctx_switch_state(struct spu_context *ctx, ...@@ -1039,13 +1039,11 @@ void spuctx_switch_state(struct spu_context *ctx,
{ {
unsigned long long curtime; unsigned long long curtime;
signed long long delta; signed long long delta;
struct timespec ts;
struct spu *spu; struct spu *spu;
enum spu_utilization_state old_state; enum spu_utilization_state old_state;
int node; int node;
ktime_get_ts(&ts); curtime = ktime_get_ns();
curtime = timespec_to_ns(&ts);
delta = curtime - ctx->stats.tstamp; delta = curtime - ctx->stats.tstamp;
WARN_ON(!mutex_is_locked(&ctx->state_mutex)); WARN_ON(!mutex_is_locked(&ctx->state_mutex));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment