From 56df8c58088b5c8b4a09ce6f5e195614251bf8d0 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 23 Mar 2017 15:32:14 +0530 Subject: gpu: nvgpu: use new List APIs to free channels Use new APIs from to access free channel list Define channel_gk20a_from_free_chs() to convert a list node to struct channel_gk20a Jira NVGPU-13 Change-Id: Idaf58f04be1c7fc553bea7c8de45951bf82bb340 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1303025 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index d530f47d..fd36ff1f 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -157,7 +158,7 @@ struct channel_gk20a_ref_action { struct channel_gk20a { struct gk20a *g; /* set only when channel is active */ - struct list_head free_chs; + struct nvgpu_list_node free_chs; struct nvgpu_spinlock ref_obtain_lock; bool referenceable; @@ -270,6 +271,13 @@ struct channel_gk20a { bool is_privileged_channel; }; +static inline struct channel_gk20a * +channel_gk20a_from_free_chs(struct nvgpu_list_node *node) +{ + return (struct channel_gk20a *) + ((uintptr_t)node - offsetof(struct channel_gk20a, free_chs)); +}; + static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch) { return !!ch->vm; -- cgit v1.2.2