]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: Remove amdgpu_bo_list_array_entry()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 20 Aug 2023 09:51:15 +0000 (11:51 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Aug 2023 19:26:45 +0000 (15:26 -0400)
Now that there is an explicit flexible array at the end of 'struct
amdgpu_bo_list', it can be used to remove amdgpu_bo_list_array_entry() and
simplify some macro.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h

index c8f59a044286d992098d4583fb645192523b289f..6ea9ff22c281cc5b82297bb296467eb4cd5b22a7 100644 (file)
@@ -87,7 +87,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
        list->gws_obj = NULL;
        list->oa_obj = NULL;
 
-       array = amdgpu_bo_list_array_entry(list, 0);
+       array = list->entries;
        memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry));
 
        for (i = 0; i < num_entries; ++i) {
index 368e50b3016084abd0a5dfe4ea076a22549743a5..6a703be45d04a9ec371d59e777a98b27dd7eead3 100644 (file)
@@ -71,22 +71,14 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev,
                                 size_t num_entries,
                                 struct amdgpu_bo_list **list);
 
-static inline struct amdgpu_bo_list_entry *
-amdgpu_bo_list_array_entry(struct amdgpu_bo_list *list, unsigned index)
-{
-       struct amdgpu_bo_list_entry *array = (void *)&list[1];
-
-       return &array[index];
-}
-
 #define amdgpu_bo_list_for_each_entry(e, list) \
-       for (e = amdgpu_bo_list_array_entry(list, 0); \
-            e != amdgpu_bo_list_array_entry(list, (list)->num_entries); \
+       for (e = list->entries; \
+            e != &list->entries[list->num_entries]; \
             ++e)
 
 #define amdgpu_bo_list_for_each_userptr_entry(e, list) \
-       for (e = amdgpu_bo_list_array_entry(list, (list)->first_userptr); \
-            e != amdgpu_bo_list_array_entry(list, (list)->num_entries); \
+       for (e = &list->entries[list->first_userptr]; \
+            e != &list->entries[list->num_entries]; \
             ++e)
 
 #endif