[PATCH 23/46] common/sfc_efx/base: allow for const in MCDI struct accessor

Ivan Malov ivan.malov at arknetworks.am
Wed Apr 16 15:59:53 CEST 2025


The existing code is fine, however, future patches will need
to use this macro on buffers that are passed by callers with
const qualifier. With 'cast-qual' enabled, this macro causes
compile warnings in such cases. Rework it to allow for const.

Signed-off-by: Ivan Malov <ivan.malov at arknetworks.am>
Reviewed-by: Andy Moreton <andy.moreton at amd.com>
Reviewed-by: Pieter Jansen Van Vuuren <pieter.jansen-van-vuuren at amd.com>
---
 drivers/common/sfc_efx/base/efx_mcdi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/sfc_efx/base/efx_mcdi.h b/drivers/common/sfc_efx/base/efx_mcdi.h
index f13bf43da6..4e82717015 100644
--- a/drivers/common/sfc_efx/base/efx_mcdi.h
+++ b/drivers/common/sfc_efx/base/efx_mcdi.h
@@ -536,7 +536,7 @@ efx_mcdi_set_nic_addr_regions(
 		EFX_DWORD_1) << 32)
 
 #define MCDI_STRUCT_MEMBER(_buf, _type, _ofst)				\
-	((_type *)((char *)_buf + _ofst ## _OFST))	\
+	((_type *)((char *)(uintptr_t)(_buf) + _ofst ## _OFST))
 
 #define MCDI_STRUCT_BYTE(_buf, _ofst)					\
 	EFX_BYTE_FIELD(*MCDI_STRUCT_MEMBER(_buf, efx_byte_t, _ofst),	\
-- 
2.39.5



More information about the dev mailing list