diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/clk_arb_linux.h')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/clk_arb_linux.h | 36 |
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 { | |||
92 | struct nvgpu_clk_dev { | 93 | struct 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 | ||
122 | static inline struct nvgpu_clk_session * | ||
123 | nvgpu_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 | |||
129 | static inline struct nvgpu_clk_dev * | ||
130 | nvgpu_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 | |||
136 | static inline struct nvgpu_clk_dev * | ||
137 | nvgpu_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 | ||