]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amdgpu/amdkfd: Avoid a couple hundred -Wflex-array-member-not-at-end warnings
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 29 Aug 2025 09:58:21 +0000 (11:58 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 2 Sep 2025 21:36:20 +0000 (17:36 -0400)
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declarations to the end of the corresponding
structures. Notice that `struct dev_pagemap` is a flexible structure,
this is a structure that contains a flexible-array member.

struct dev_pagemap always has room for at least one range. amdgpu only
uses a single range. Therefore no change are needed to the allocation
of struct amdgpu_device.

Fix 283 of the following type of warnings:
    283 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:111:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

index 01f53700694bc3bb51822af1b4ff0eb2285f5621..17848ce65d1f624b646cf9893c7b59aa66718468 100644 (file)
@@ -1149,9 +1149,6 @@ struct amdgpu_device {
        /* for userq and VM fences */
        struct amdgpu_seq64             seq64;
 
-       /* KFD */
-       struct amdgpu_kfd_dev           kfd;
-
        /* UMC */
        struct amdgpu_umc               umc;
 
@@ -1314,6 +1311,11 @@ struct amdgpu_device {
        struct mutex                    userq_mutex;
        bool                            userq_halt_for_enforce_isolation;
        struct amdgpu_uid *uid_info;
+
+       /* KFD
+        * Must be last --ends in a flexible-array member.
+        */
+       struct amdgpu_kfd_dev           kfd;
 };
 
 static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
index 33eb4826b58b1a84a410b112b38e777064ccf9af..127927b16ee2919a1119dd553926c2cae546139c 100644 (file)
@@ -107,11 +107,13 @@ struct amdgpu_kfd_dev {
        bool init_complete;
        struct work_struct reset_work;
 
-       /* HMM page migration MEMORY_DEVICE_PRIVATE mapping */
-       struct dev_pagemap pgmap;
-
        /* Client for KFD BO GEM handle allocations */
        struct drm_client_dev client;
+
+       /* HMM page migration MEMORY_DEVICE_PRIVATE mapping
+        * Must be last --ends in a flexible-array member.
+        */
+       struct dev_pagemap pgmap;
 };
 
 enum kgd_engine_type {