From d0a77f558ef8d101059c6238abd46a9a97191564 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 3 Jul 2017 13:49:27 +0300 Subject: gpu: nvgpu: use u32 for timeout API duration A negative value in the timeout duration does not have any special uses, so change the duration type to u32 (from just int). Delete some unnecessary typecasts to int. Also change MAX_SCHEDULE_TIMEOUT to ULONG_MAX in default gr idle timeout because the value is in milliseconds instead of scheduling units and to drop unnecessary Linux dependency. Change-Id: I5cf6febd4f1cb00c46fe159603436a9ac3b003ac Signed-off-by: Konsta Holtta Reviewed-on: https://git-master/r/1512565 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/timers.c | 8 +------- drivers/gpu/nvgpu/common/pmu/pmu_ipc.c | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c index 2953902e..5786b240 100644 --- a/drivers/gpu/nvgpu/common/linux/timers.c +++ b/drivers/gpu/nvgpu/common/linux/timers.c @@ -54,12 +54,9 @@ static int nvgpu_timeout_is_pre_silicon(struct nvgpu_timeout *timeout) * * If neither %NVGPU_TIMER_CPU_TIMER or %NVGPU_TIMER_RETRY_TIMER is passed then * a CPU timer is used by default. - * - * A negative duration is interpreted as the maximum possible, which for our - * purposes means infinite wait. */ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, - int duration, unsigned long flags) + u32 duration, unsigned long flags) { if (flags & ~NVGPU_TIMER_FLAG_MASK) return -EINVAL; @@ -69,9 +66,6 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, timeout->g = g; timeout->flags = flags; - if (duration < 0) - duration = INT_MAX; - if (flags & NVGPU_TIMER_RETRY_TIMER) timeout->retries.max = duration; else diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c index 0dbc2df3..6dffdf0f 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c @@ -453,7 +453,7 @@ static int pmu_write_cmd(struct nvgpu_pmu *pmu, struct pmu_cmd *cmd, nvgpu_log_fn(g, " "); queue = &pmu->queue[queue_id]; - nvgpu_timeout_init(g, &timeout, (int)timeout_ms, NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, timeout_ms, NVGPU_TIMER_CPU_TIMER); do { err = pmu_queue_open_write(pmu, queue, cmd->hdr.size); @@ -878,7 +878,7 @@ int pmu_wait_message_cond(struct nvgpu_pmu *pmu, u32 timeout_ms, struct nvgpu_timeout timeout; unsigned long delay = GR_IDLE_CHECK_DEFAULT; - nvgpu_timeout_init(g, &timeout, (int)timeout_ms, NVGPU_TIMER_CPU_TIMER); + nvgpu_timeout_init(g, &timeout, timeout_ms, NVGPU_TIMER_CPU_TIMER); do { if (*var == val) -- cgit v1.2.2