[PATCH 9/9] drm/amdgpu: calculate actual size instead of hardcode size

Guchun Chen guchun.chen at amd.com
Thu Jul 23 08:33:46 UTC 2020


Use sizeof to get actual size.

v2: correct other confused comment of head and record size.

Signed-off-by: Guchun Chen <guchun.chen at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index d27cd5ae431a..12ae8eb3b53e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
@@ -31,14 +31,9 @@
 #define EEPROM_I2C_TARGET_ADDR_ARCTURUS  	0xA8
 #define EEPROM_I2C_TARGET_ADDR_ARCTURUS_D342  	0xA0
 
-/*
- * The 2 macros bellow represent the actual size in bytes that
- * those entities occupy in the EEPROM memory.
- * EEPROM_TABLE_RECORD_SIZE is different than sizeof(eeprom_table_record) which
- * uses uint64 to store 6b fields such as retired_page.
- */
-#define EEPROM_TABLE_HEADER_SIZE 20
-#define EEPROM_TABLE_RECORD_SIZE 24
+/* Define head and record size in EEPROM memory. */
+#define EEPROM_TABLE_HEADER_SIZE (sizeof(struct amdgpu_ras_eeprom_table_header))
+#define EEPROM_TABLE_RECORD_SIZE (sizeof(struct eeprom_table_record))
 
 #define EEPROM_ADDRESS_SIZE 0x2
 
-- 
2.17.1



More information about the amd-gfx mailing list