summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h
diff options
context:
space:
mode:
authorSourab Gupta <sourabg@nvidia.com>2018-05-01 00:57:15 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-07 07:42:42 -0400
commit35ec3008310c50b4a35a391371f4baff2e023a4e (patch)
tree278ed1b2091a9be69c0ec9e5d406f74f95b6cec9 /drivers/gpu/nvgpu/common/linux/clk_arb_linux.h
parent2b498cdf8aaa6c628cc1ac8e2b0b3a582c0decb3 (diff)
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 <sourabg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1705962 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/clk_arb_linux.h')
-rw-r--r--drivers/gpu/nvgpu/common/linux/clk_arb_linux.h36
1 files changed, 29 insertions, 7 deletions
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 @@
27#include <nvgpu/log.h> 27#include <nvgpu/log.h>
28#include <nvgpu/barrier.h> 28#include <nvgpu/barrier.h>
29#include <nvgpu/cond.h> 29#include <nvgpu/cond.h>
30#include <nvgpu/list.h>
30 31
31#include "gk20a/gk20a.h" 32#include "gk20a/gk20a.h"
32#include "clk/clk.h" 33#include "clk/clk.h"
@@ -44,9 +45,9 @@ struct nvgpu_clk_arb {
44 struct nvgpu_spinlock requests_lock; 45 struct nvgpu_spinlock requests_lock;
45 46
46 struct nvgpu_mutex pstate_lock; 47 struct nvgpu_mutex pstate_lock;
47 struct list_head users; 48 struct nvgpu_list_node users;
48 struct list_head sessions; 49 struct nvgpu_list_node sessions;
49 struct list_head requests; 50 struct nvgpu_list_node requests;
50 51
51 struct gk20a *g; 52 struct gk20a *g;
52 int status; 53 int status;
@@ -92,8 +93,8 @@ struct nvgpu_clk_arb {
92struct nvgpu_clk_dev { 93struct nvgpu_clk_dev {
93 struct nvgpu_clk_session *session; 94 struct nvgpu_clk_session *session;
94 union { 95 union {
95 struct list_head link; 96 struct nvgpu_list_node link;
96 struct list_head node; 97 struct nvgpu_list_node node;
97 }; 98 };
98 struct nvgpu_cond readout_wq; 99 struct nvgpu_cond readout_wq;
99 nvgpu_atomic_t poll_mask; 100 nvgpu_atomic_t poll_mask;
@@ -110,13 +111,34 @@ struct nvgpu_clk_session {
110 bool zombie; 111 bool zombie;
111 struct gk20a *g; 112 struct gk20a *g;
112 struct nvgpu_ref refcount; 113 struct nvgpu_ref refcount;
113 struct list_head link; 114 struct nvgpu_list_node link;
114 struct list_head targets; 115 struct nvgpu_list_node targets;
115 116
116 struct nvgpu_spinlock session_lock; 117 struct nvgpu_spinlock session_lock;
117 struct nvgpu_clk_arb_target target_pool[2]; 118 struct nvgpu_clk_arb_target target_pool[2];
118 struct nvgpu_clk_arb_target *target; 119 struct nvgpu_clk_arb_target *target;
119}; 120};
120 121
122static inline struct nvgpu_clk_session *
123nvgpu_clk_session_from_link(struct nvgpu_list_node *node)
124{
125 return (struct nvgpu_clk_session *)
126 ((uintptr_t)node - offsetof(struct nvgpu_clk_session, link));
127};
128
129static inline struct nvgpu_clk_dev *
130nvgpu_clk_dev_from_node(struct nvgpu_list_node *node)
131{
132 return (struct nvgpu_clk_dev *)
133 ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, node));
134};
135
136static inline struct nvgpu_clk_dev *
137nvgpu_clk_dev_from_link(struct nvgpu_list_node *node)
138{
139 return (struct nvgpu_clk_dev *)
140 ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, link));
141};
142
121#endif /* __NVGPU_CLK_ARB_LINUX_H__ */ 143#endif /* __NVGPU_CLK_ARB_LINUX_H__ */
122 144