From 0d8830394adf94fee8f69bc034293d1880e9d8db Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 10 Feb 2017 17:35:58 +0530 Subject: gpu: nvgpu: use nvgpu list for page chunks Use nvgpu list APIs instead of linux list APIs to store chunks of page allocator Jira NVGPU-13 Change-Id: I63375fc2df683e018c48a90b76eca368438cc32f Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1326814 Reviewed-by: Konsta Holtta Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/include/nvgpu/page_allocator.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h b/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h index fa586dba..92f48ac5 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h @@ -22,6 +22,7 @@ #include #include +#include struct nvgpu_allocator; @@ -78,19 +79,26 @@ struct page_alloc_slab_page { }; struct page_alloc_chunk { - struct list_head list_entry; + struct nvgpu_list_node list_entry; u64 base; u64 length; }; +static inline struct page_alloc_chunk * +page_alloc_chunk_from_list_entry(struct nvgpu_list_node *node) +{ + return (struct page_alloc_chunk *) + ((uintptr_t)node - offsetof(struct page_alloc_chunk, list_entry)); +}; + /* * Struct to handle internal management of page allocation. It holds a list * of the chunks of pages that make up the overall allocation - much like a * scatter gather table. */ struct nvgpu_page_alloc { - struct list_head alloc_chunks; + struct nvgpu_list_node alloc_chunks; int nr_chunks; u64 length; -- cgit v1.2.2