Skip to contentSkip to conversation

drm/amd/pm: suppress compile warning about possible unaligned accesses

PATCH In review Evan Quan 2 participants 2 messages May 7, 2022 – May 9, 2022

Subsystems (3)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/pm: suppress compile warning about possible unaligned accesses

Suppress the following compile warning:
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_0_ppt.c:39:

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../pm/inc/smu_v13_0_0_pptable.h:194:39:

warning: field overdrive_table within 'struct smu_13_0_0_powerplay_table' is less aligned than 'struct smu_13_0_0_overdrive_table' and is usually due to 'struct smu_13_0_0_powerplay_table' being packed,
which can lead to unaligned accesses [-Wunaligned-access]

Change-Id Ibba9dbfcc6440d0bdf0fbe0534ce6a82ab6d5d10
---
 drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h +4 -1
index 670f2ef67868..566a0da59e53 100644
@@ -22,6 +22,8 @@
 #ifndef SMU_13_0_0_PPTABLE_H
 #define SMU_13_0_0_PPTABLE_H
 
+#pragma pack(push, 1)
+
 #define SMU_13_0_0_TABLE_FORMAT_REVISION 15
 
 //// POWERPLAYTABLE::ulPlatformCaps
@@ -194,7 +196,8 @@ struct smu_13_0_0_powerplay_table
     struct smu_13_0_0_overdrive_table overdrive_table;
     uint8_t padding1;
     PPTable_t smc_pptable; //PPTable_t in driver_if.h
-} __attribute__((packed));
+};
 
+#pragma pack(pop)
 
 #endif
Signature · 1 line
2.29.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Evan Quan

Suppress the following compile warning:

   In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_0_ppt.c:39:
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../pm/inc/smu_v13_0_0_pptable.h:194:39:

warning: field overdrive_table within 'struct smu_13_0_0_powerplay_table' is less aligned than 'struct smu_13_0_0_overdrive_table' and is usually due to 'struct smu_13_0_0_powerplay_table' being packed,
which can lead to unaligned accesses [-Wunaligned-access]

Quoted 31 lines

Change-Id: Ibba9dbfcc6440d0bdf0fbe0534ce6a82ab6d5d10

---
 drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h +4 -2
index 670f2ef67868..566a0da59e53 100644
@@ -22,6 +22,8 @@
 #ifndef SMU_13_0_0_PPTABLE_H
 #define SMU_13_0_0_PPTABLE_H
 
+#pragma pack(push, 1)
+
 #define SMU_13_0_0_TABLE_FORMAT_REVISION 15
 
 //// POWERPLAYTABLE::ulPlatformCaps
@@ -194,7 +196,8 @@ struct smu_13_0_0_powerplay_table
     struct smu_13_0_0_overdrive_table overdrive_table;
     uint8_t padding1;
     PPTable_t smc_pptable; //PPTable_t in driver_if.h
-} __attribute__((packed));
+};
 
+#pragma pack(pop)
 
 #endif
--

2.29.0