@@ -83,6 +83,11 @@ struct rtw8723d_efuse {
};
};
+static_assert(offsetof(struct rtw8723d_efuse, e) == 0xd0);
+static_assert(sizeof(struct rtw8723de_efuse) == 14);
+static_assert(offsetof(struct rtw8723d_efuse, u) == 0xd0);
+static_assert(sizeof(struct rtw8723du_efuse) == 59);
+
extern const struct rtw_chip_info rtw8723d_hw_spec;
/* phy status page0 */
@@ -97,6 +97,11 @@ struct rtw8821c_efuse {
};
};
+static_assert(offsetof(struct rtw8821c_efuse, e) == 0xd0);
+static_assert(sizeof(struct rtw8821ce_efuse) == 49);
+static_assert(offsetof(struct rtw8821c_efuse, u) == 0xd0);
+static_assert(sizeof(struct rtw8821cu_efuse) == 304);
+
static inline void
_rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
{
@@ -97,6 +97,11 @@ struct rtw8822b_efuse {
};
};
+static_assert(offsetof(struct rtw8822b_efuse, e) == 0xd0);
+static_assert(sizeof(struct rtw8822be_efuse) == 49);
+static_assert(offsetof(struct rtw8822b_efuse, u) == 0xd0);
+static_assert(sizeof(struct rtw8822bu_efuse) == 304);
+
static inline void
_rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
{
@@ -96,6 +96,11 @@ struct rtw8822c_efuse {
};
};
+static_assert(offsetof(struct rtw8822c_efuse, e) == 0x120);
+static_assert(sizeof(struct rtw8822ce_efuse) == 47);
+static_assert(offsetof(struct rtw8822c_efuse, u) == 0x120);
+static_assert(sizeof(struct rtw8822cu_efuse) == 122);
+
enum rtw8822c_dpk_agc_phase {
RTW_DPK_GAIN_CHECK,
RTW_DPK_GAIN_LARGE,
Add static assertions for the PCIe/USB offsets inside the eFuse structs to ensure that the compiler doesn't add padding anywhere (relevant) inside the structs. Suggested-by: Ping-Ke Shih <pkshih@realtek.com> Suggested-by: David Laight <David.Laight@aculab.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- This is the continuation of my patch from [0] where initially I added __packed attributes to the eFuse structs. David raised concerns that this is the "sledgehammer" way of doing things and it can impact performance. So this implementation is my understanding of David's suggestion from [1] (and Ping-Ke also suggested a similar approach for debugging a size difference I've been seeing with / without __packed). [0] https://lore.kernel.org/linux-wireless/20221228133547.633797-2-martin.blumenstingl@googlemail.com/ [1] https://lore.kernel.org/linux-wireless/4c4551c787ee4fc9ac40b34707d7365a@AcuMS.aculab.com/ drivers/net/wireless/realtek/rtw88/rtw8723d.h | 5 +++++ drivers/net/wireless/realtek/rtw88/rtw8821c.h | 5 +++++ drivers/net/wireless/realtek/rtw88/rtw8822b.h | 5 +++++ drivers/net/wireless/realtek/rtw88/rtw8822c.h | 5 +++++ 4 files changed, 20 insertions(+)