From 92fe0007496fd42983a6849b4f8dd5bc7d124834 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 12 Dec 2016 10:10:08 +0200 Subject: gpu: nvgpu: rename timeout_check to timeout_expired Change "check" to "expired" in nvgpu_timeout_check* and append _expired to nvgpu_timeout_peek to clarify what the boolean-like return value means and thus avoid bugs. Bug 200260715 Change-Id: I47e097ee922e856005a79fa9e27eddb1c8d77f8b Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1269366 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/timers.c | 16 ++++++++-------- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 18 +++++++++--------- drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 6 +++--- drivers/gpu/nvgpu/include/nvgpu/timers.h | 12 ++++++------ 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c index e1e08f82..b7fe30f1 100644 --- a/drivers/gpu/nvgpu/common/linux/timers.c +++ b/drivers/gpu/nvgpu/common/linux/timers.c @@ -71,7 +71,7 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, return 0; } -static int __nvgpu_timeout_check_msg_cpu(struct nvgpu_timeout *timeout, +static int __nvgpu_timeout_expired_msg_cpu(struct nvgpu_timeout *timeout, void *caller, const char *fmt, va_list args) { @@ -97,7 +97,7 @@ static int __nvgpu_timeout_check_msg_cpu(struct nvgpu_timeout *timeout, return 0; } -static int __nvgpu_timeout_check_msg_retry(struct nvgpu_timeout *timeout, +static int __nvgpu_timeout_expired_msg_retry(struct nvgpu_timeout *timeout, void *caller, const char *fmt, va_list args) { @@ -125,7 +125,7 @@ static int __nvgpu_timeout_check_msg_retry(struct nvgpu_timeout *timeout, } /** - * __nvgpu_timeout_check_msg - Check if a timeout has expired. + * __nvgpu_timeout_expired_msg - Check if a timeout has expired. * * @timeout - The timeout to check. * @caller - Address of the caller of this function. @@ -136,7 +136,7 @@ static int __nvgpu_timeout_check_msg_retry(struct nvgpu_timeout *timeout, * If a timeout occurs and %NVGPU_TIMER_SILENT_TIMEOUT is not set in the timeout * then a message is printed based on %fmt. */ -int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, +int __nvgpu_timeout_expired_msg(struct nvgpu_timeout *timeout, void *caller, const char *fmt, ...) { int ret; @@ -144,10 +144,10 @@ int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, va_start(args, fmt); if (timeout->flags & NVGPU_TIMER_RETRY_TIMER) - ret = __nvgpu_timeout_check_msg_retry(timeout, caller, fmt, + ret = __nvgpu_timeout_expired_msg_retry(timeout, caller, fmt, args); else - ret = __nvgpu_timeout_check_msg_cpu(timeout, caller, fmt, + ret = __nvgpu_timeout_expired_msg_cpu(timeout, caller, fmt, args); va_end(args); @@ -155,7 +155,7 @@ int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, } /** - * nvgpu_timeout_peek - Check the status of a timeout. + * nvgpu_timeout_peek_expired - Check the status of a timeout. * * @timeout - The timeout to check. * @@ -165,7 +165,7 @@ int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, * * This function honors the pre-Si check as well. */ -int nvgpu_timeout_peek(struct nvgpu_timeout *timeout) +int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout) { if (nvgpu_timeout_is_pre_silicon(timeout)) return 0; diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 8ac6d1d1..792fa098 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -5049,9 +5049,9 @@ int gk20a_mm_fb_flush(struct gk20a *g) udelay(5); } else break; - } while (!nvgpu_timeout_check(&timeout)); + } while (!nvgpu_timeout_expired(&timeout)); - if (nvgpu_timeout_peek(&timeout)) { + if (nvgpu_timeout_peek_expired(&timeout)) { if (g->ops.fb.dump_vpr_wpr_info) g->ops.fb.dump_vpr_wpr_info(g); ret = -EBUSY; @@ -5092,9 +5092,9 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g) udelay(5); } else break; - } while (!nvgpu_timeout_check(&timeout)); + } while (!nvgpu_timeout_expired(&timeout)); - if (nvgpu_timeout_peek(&timeout)) + if (nvgpu_timeout_peek_expired(&timeout)) gk20a_warn(dev_from_gk20a(g), "l2_system_invalidate too many retries"); @@ -5147,7 +5147,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) udelay(5); } else break; - } while (!nvgpu_timeout_check_msg(&timeout, + } while (!nvgpu_timeout_expired_msg(&timeout, "l2_flush_dirty too many retries")); trace_gk20a_mm_l2_flush_done(dev_name(g->dev)); @@ -5192,7 +5192,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g) udelay(5); } else break; - } while (!nvgpu_timeout_check_msg(&timeout, + } while (!nvgpu_timeout_expired_msg(&timeout, "l2_clean_comptags too many retries")); mutex_unlock(&mm->l2_op_lock); @@ -5259,10 +5259,10 @@ void gk20a_mm_tlb_invalidate(struct vm_gk20a *vm) if (fb_mmu_ctrl_pri_fifo_space_v(data) != 0) break; udelay(2); - } while (!nvgpu_timeout_check_msg(&timeout, + } while (!nvgpu_timeout_expired_msg(&timeout, "wait mmu fifo space")); - if (nvgpu_timeout_peek(&timeout)) + if (nvgpu_timeout_peek_expired(&timeout)) goto out; nvgpu_timeout_init(g, &timeout, 1000, NVGPU_TIMER_RETRY_TIMER); @@ -5283,7 +5283,7 @@ void gk20a_mm_tlb_invalidate(struct vm_gk20a *vm) fb_mmu_ctrl_pri_fifo_empty_false_f()) break; udelay(2); - } while (!nvgpu_timeout_check_msg(&timeout, + } while (!nvgpu_timeout_expired_msg(&timeout, "wait mmu invalidate")); trace_gk20a_mm_tlb_invalidate_done(dev_name(g->dev)); diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index 1d580dae..853011f2 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c @@ -2129,7 +2129,7 @@ int pmu_idle(struct pmu_gk20a *pmu) break; } - if (nvgpu_timeout_check_msg(&timeout, + if (nvgpu_timeout_expired_msg(&timeout, "waiting for pmu idle: 0x%08x", idle_stat)) return -EBUSY; @@ -4058,7 +4058,7 @@ int pmu_wait_message_cond(struct pmu_gk20a *pmu, u32 timeout_ms, usleep_range(delay, delay * 2); delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); - } while (!nvgpu_timeout_check(&timeout)); + } while (!nvgpu_timeout_expired(&timeout)); return -ETIMEDOUT; } @@ -4409,7 +4409,7 @@ static int pmu_write_cmd(struct pmu_gk20a *pmu, struct pmu_cmd *cmd, do { err = pmu_queue_open_write(pmu, queue, cmd->hdr.size); - if (err == -EAGAIN && !nvgpu_timeout_check(&timeout)) + if (err == -EAGAIN && !nvgpu_timeout_expired(&timeout)) usleep_range(1000, 2000); else break; diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h index e46982c9..0ecbc183 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h @@ -74,21 +74,21 @@ struct nvgpu_timeout { int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, int duration, unsigned long flags); -int nvgpu_timeout_peek(struct nvgpu_timeout *timeout); +int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout); -#define nvgpu_timeout_check(__timeout) \ - __nvgpu_timeout_check_msg(__timeout, \ +#define nvgpu_timeout_expired(__timeout) \ + __nvgpu_timeout_expired_msg(__timeout, \ __builtin_return_address(0), "") -#define nvgpu_timeout_check_msg(__timeout, fmt, args...) \ - __nvgpu_timeout_check_msg(__timeout, \ +#define nvgpu_timeout_expired_msg(__timeout, fmt, args...) \ + __nvgpu_timeout_expired_msg(__timeout, \ __builtin_return_address(0), \ fmt, ##args) /* * Don't use this directly. */ -int __nvgpu_timeout_check_msg(struct nvgpu_timeout *timeout, +int __nvgpu_timeout_expired_msg(struct nvgpu_timeout *timeout, void *caller, const char *fmt, ...); #endif -- cgit v1.2.2