From e0fa45135a3412647f5b5dc97389fa088938d58c Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 14 May 2019 13:35:18 -0400 Subject: [PATCH] gpu: nvgpu: timers: fix MISRA 5.5 violation MISRA Rule 5.5 requires identifiers be unique from macro names. The struct timeout member max is renamed to max_attempts to fix the violation. JIRA NVGPU-3374 Change-Id: I701899e38a25b654d5f78feabbb273e21601f313 Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/2118815 GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Fleury Reviewed-by: Vinod Gopalakrishnakurup Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/timers.h | 2 +- drivers/gpu/nvgpu/os/linux/timers.c | 7 ++++--- drivers/gpu/nvgpu/os/posix/timers.c | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h index fcde49169..7ce26116e 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h @@ -59,7 +59,7 @@ struct nvgpu_timeout { union { s64 time; struct { - u32 max; + u32 max_attempts; u32 attempted; } retries; }; diff --git a/drivers/gpu/nvgpu/os/linux/timers.c b/drivers/gpu/nvgpu/os/linux/timers.c index af52277f4..e1051dfc7 100644 --- a/drivers/gpu/nvgpu/os/linux/timers.c +++ b/drivers/gpu/nvgpu/os/linux/timers.c @@ -67,7 +67,7 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, timeout->flags = flags; if (flags & NVGPU_TIMER_RETRY_TIMER) - timeout->retries.max = duration; + timeout->retries.max_attempts = duration; else timeout->time = ktime_to_ns(ktime_add_ns(ktime_get(), (s64)NSEC_PER_MSEC * duration)); @@ -109,7 +109,7 @@ static int nvgpu_timeout_expired_msg_retry(struct nvgpu_timeout *timeout, if (nvgpu_timeout_is_pre_silicon(timeout)) return 0; - if (timeout->retries.attempted >= timeout->retries.max) { + if (timeout->retries.attempted >= timeout->retries.max_attempts) { if (!(timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT)) { char buf[128]; @@ -173,7 +173,8 @@ int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout) return 0; if (timeout->flags & NVGPU_TIMER_RETRY_TIMER) - return timeout->retries.attempted >= timeout->retries.max; + return timeout->retries.attempted >= + timeout->retries.max_attempts; else return ktime_after(ktime_get(), ns_to_ktime(timeout->time)); } diff --git a/drivers/gpu/nvgpu/os/posix/timers.c b/drivers/gpu/nvgpu/os/posix/timers.c index a30ff052d..2c159c1c6 100644 --- a/drivers/gpu/nvgpu/os/posix/timers.c +++ b/drivers/gpu/nvgpu/os/posix/timers.c @@ -85,7 +85,7 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, timeout->flags = (unsigned int)flags; if ((flags & NVGPU_TIMER_RETRY_TIMER) != 0U) { - timeout->retries.max = duration; + timeout->retries.max_attempts = duration; } else { duration_ns = (s64)duration; duration_ns *= NSEC_PER_MSEC; @@ -122,7 +122,7 @@ static int nvgpu_timeout_expired_msg_retry(struct nvgpu_timeout *timeout, { struct gk20a *g = timeout->g; - if (timeout->retries.attempted >= timeout->retries.max) { + if (timeout->retries.attempted >= timeout->retries.max_attempts) { if ((timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT) == 0U) { char buf[128]; @@ -162,7 +162,7 @@ int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout) { if ((timeout->flags & NVGPU_TIMER_RETRY_TIMER) != 0U) { return (int) (timeout->retries.attempted >= - timeout->retries.max); + timeout->retries.max_attempts); } else { return (int) (time_after(get_time_ns(), timeout->time)); }