From 280dceb86466c37f5a3d9835adc95c068d0a24af Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Wed, 10 Jul 2019 14:02:21 -0700 Subject: [PATCH] gpu: nvgpu: fix MISRA issues nvgpu.common.clk_arb MISRA Rule 5.7 doesn't allow reuse of variable or tag name. MISRA Rule 21.x forbids use of identifiers beginning with an underscore. This patch resolves MISRA violations in nvgpu.common.clk_arb for above mentioned rules. Jira NVGPU-3740 Change-Id: I73234d1a9e1c98812620dd1c3b9a80426742e747 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/2151248 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sagar Kamble Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/clk_arb/clk_arb.c | 2 +- drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | 7 ++++--- drivers/gpu/nvgpu/os/linux/ioctl_clk_arb.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c b/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c index 68c0853fd..7942f8047 100644 --- a/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c +++ b/drivers/gpu/nvgpu/common/clk_arb/clk_arb.c @@ -274,7 +274,7 @@ u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev, head = (tail - head) < arb->notification_queue.size ? head : tail - arb->notification_queue.size; - for (index = head; _WRAPGTEQ(tail, index); index++) { + for (index = head; WRAPGTEQ(tail, index); index++) { u32 alarm_detected; l_notification = &arb->notification_queue. diff --git a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h index 0aa18c363..0938e51f0 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h +++ b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h @@ -49,7 +49,8 @@ struct nvgpu_clk_notification_queue; struct nvgpu_clk_session; #define VF_POINT_INVALID_PSTATE ~0U -#define VF_POINT_SET_PSTATE_SUPPORTED(a, b) ((a)->pstates |= (BIT16(b))) +#define VF_POINT_SET_PSTATE_SUPPORTED(a, b) \ + ((a)->clk_vf_point_pstates |= (BIT16(b))) #define VF_POINT_GET_PSTATE(a) (((a)->pstates) ?\ (nvgpu_fls((a)->pstates) - 1UL) :\ VF_POINT_INVALID_PSTATE) @@ -92,7 +93,7 @@ struct nvgpu_clk_session; #define LOCAL_ALARM_MASK (EVENT(ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE) | \ EVENT(VF_UPDATE)) -#define _WRAPGTEQ(a, b) (((a)-(b)) > (typeof(a))0) +#define WRAPGTEQ(a, b) (((a)-(b)) > (typeof(a))0) /* * NVGPU_POLL* defines equivalent to the POLL* linux defines @@ -132,7 +133,7 @@ struct nvgpu_clk_notification_queue { }; struct nvgpu_clk_vf_point { - u16 pstates; + u16 clk_vf_point_pstates; union { struct { u16 gpc_mhz; diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_clk_arb.c b/drivers/gpu/nvgpu/os/linux/ioctl_clk_arb.c index 7083b9003..a7c5b7767 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_clk_arb.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_clk_arb.c @@ -172,7 +172,7 @@ static inline u32 __pending_event(struct nvgpu_clk_dev *dev, head = (tail - head) < dev->queue.size ? head : tail - dev->queue.size; - if (_WRAPGTEQ(tail, head) && info) { + if (WRAPGTEQ(tail, head) && info) { head++; p_notif = &dev->queue.clk_q_notifications[ head % dev->queue.size];