From 261bdb9cc2ed87b117c554e0f3dc627a7a6d2ee4 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Sun, 6 Jun 2021 21:49:20 -0700 Subject: [PATCH] gpu: nvgpu: fix MISRA violations in common.fifo - Rule 8.6 requires each identifier with external linkage to have exactly one external definitions. - Define macro instead of constant value of maximum gpfifo entries. Jira NVGPU-6262 Change-Id: If8f4b9fa06db62a03d487b9e3dd8157a40cffe16 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2540462 (cherry picked from commit 03a42b55b29dc3503999f4728589f0bd17b75c76) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2544846 Reviewed-by: Vaibhav Kachore Reviewed-by: svcacv Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 4 +++- drivers/gpu/nvgpu/include/nvgpu/channel.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index a4a808e64..e226b7c26 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -69,6 +69,8 @@ #include "channel_wdt.h" #include "channel_worker.h" +#define CHANNEL_MAX_GPFIFO_ENTRIES 0x80000000U + static void free_channel(struct nvgpu_fifo *f, struct nvgpu_channel *ch); static void channel_dump_ref_actions(struct nvgpu_channel *ch); @@ -1409,7 +1411,7 @@ static int channel_setup_bind_prechecks(struct nvgpu_channel *c, struct nvgpu_tsg *tsg; int err = 0; - if (args->num_gpfifo_entries > 0x80000000U) { + if (args->num_gpfifo_entries > CHANNEL_MAX_GPFIFO_ENTRIES) { nvgpu_err(g, "num_gpfifo_entries exceeds max limit of 2^31"); err = -EINVAL; diff --git a/drivers/gpu/nvgpu/include/nvgpu/channel.h b/drivers/gpu/nvgpu/include/nvgpu/channel.h index e8d754ba0..1277877fc 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/channel.h +++ b/drivers/gpu/nvgpu/include/nvgpu/channel.h @@ -831,6 +831,7 @@ int nvgpu_channel_suspend_all_serviceable_ch(struct gk20a *g); */ int nvgpu_channel_resume_all_serviceable_ch(struct gk20a *g); +#ifdef CONFIG_NVGPU_DETERMINISTIC_CHANNELS /** * @brief Stop deterministic channel activity for do_idle(). * @@ -857,6 +858,7 @@ void nvgpu_channel_deterministic_idle(struct gk20a *g); * @note Must be paired with #nvgpu_channel_deterministic_idle(). */ void nvgpu_channel_deterministic_unidle(struct gk20a *g); +#endif /** * @brief Get a reference to the channel.