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 <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2118815
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2019-05-14 13:35:18 -04:00
committed by mobile promotions
parent bb1ca4fef5
commit e0fa45135a
3 changed files with 8 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ struct nvgpu_timeout {
union {
s64 time;
struct {
u32 max;
u32 max_attempts;
u32 attempted;
} retries;
};

View File

@@ -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));
}

View File

@@ -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));
}