From 35ec3008310c50b4a35a391371f4baff2e023a4e Mon Sep 17 00:00:00 2001 From: Sourab Gupta Date: Tue, 1 May 2018 10:27:15 +0530 Subject: gpu: nvgpu: use nvgpu_list in clk arb code clk arbiter code uses linux kernel specific 'list' handling. Use 'nvgpu_list' data structure and constructs instead. Also, remove other linux includes from clk_arb.c, while at it. Jira VQRM-3741 Change-Id: I89bf73a62537447dc23726a43e1f6ad96589ae34 Signed-off-by: Sourab Gupta Reviewed-on: https://git-master.nvidia.com/r/1705962 Reviewed-by: svc-mobile-coverity Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/clk_arb_linux.h | 36 +++++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/clk_arb_linux.h') diff --git a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h index 0942dd86..e5ada25d 100644 --- a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h +++ b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "gk20a/gk20a.h" #include "clk/clk.h" @@ -44,9 +45,9 @@ struct nvgpu_clk_arb { struct nvgpu_spinlock requests_lock; struct nvgpu_mutex pstate_lock; - struct list_head users; - struct list_head sessions; - struct list_head requests; + struct nvgpu_list_node users; + struct nvgpu_list_node sessions; + struct nvgpu_list_node requests; struct gk20a *g; int status; @@ -92,8 +93,8 @@ struct nvgpu_clk_arb { struct nvgpu_clk_dev { struct nvgpu_clk_session *session; union { - struct list_head link; - struct list_head node; + struct nvgpu_list_node link; + struct nvgpu_list_node node; }; struct nvgpu_cond readout_wq; nvgpu_atomic_t poll_mask; @@ -110,13 +111,34 @@ struct nvgpu_clk_session { bool zombie; struct gk20a *g; struct nvgpu_ref refcount; - struct list_head link; - struct list_head targets; + struct nvgpu_list_node link; + struct nvgpu_list_node targets; struct nvgpu_spinlock session_lock; struct nvgpu_clk_arb_target target_pool[2]; struct nvgpu_clk_arb_target *target; }; +static inline struct nvgpu_clk_session * +nvgpu_clk_session_from_link(struct nvgpu_list_node *node) +{ + return (struct nvgpu_clk_session *) + ((uintptr_t)node - offsetof(struct nvgpu_clk_session, link)); +}; + +static inline struct nvgpu_clk_dev * +nvgpu_clk_dev_from_node(struct nvgpu_list_node *node) +{ + return (struct nvgpu_clk_dev *) + ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, node)); +}; + +static inline struct nvgpu_clk_dev * +nvgpu_clk_dev_from_link(struct nvgpu_list_node *node) +{ + return (struct nvgpu_clk_dev *) + ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, link)); +}; + #endif /* __NVGPU_CLK_ARB_LINUX_H__ */ -- cgit v1.2.2