Skip to contentSkip to conversation

MIPS: OCTEON: Replace SIZEOF_FIELD() macro

PATCH Superseded Kees Cook 2 participants 2 messages Oct 10, 2019 MIPS

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 MIPS: OCTEON: Replace SIZEOF_FIELD() macro

From: Pankaj Bharadiya <[email protected]>

In preparation for switching to a standard sizeof_member() macro to find the size of a member of a struct, remove the custom SIZEOF_FIELD() macro and use the more common FIELD_SIZEOF() instead. Later patches will globally replace FIELD_SIZEOF() and sizeof_field() with the more accurate sizeof_member().

---
 arch/mips/cavium-octeon/executive/cvmx-bootmem.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/mips/cavium-octeon/executive/cvmx-bootmem.c +1 -8
index ba8f82a29a81..44b506a14666 100644
@@ -44,13 +44,6 @@ static struct cvmx_bootmem_desc *cvmx_bootmem_desc;
 
 /* See header file for descriptions of functions */
 
-/**
- * This macro returns the size of a member of a structure.
- * Logically it is the same as "sizeof(s::field)" in C++, but
- * C lacks the "::" operator.
- */
-#define SIZEOF_FIELD(s, field) sizeof(((s *)NULL)->field)
-
 /**
  * This macro returns a member of the
  * cvmx_bootmem_named_block_desc_t structure. These members can't
@@ -65,7 +58,7 @@ static struct cvmx_bootmem_desc *cvmx_bootmem_desc;
 #define CVMX_BOOTMEM_NAMED_GET_FIELD(addr, field)			\
 	__cvmx_bootmem_desc_get(addr,					\
 		offsetof(struct cvmx_bootmem_named_block_desc, field),	\
-		SIZEOF_FIELD(struct cvmx_bootmem_named_block_desc, field))
+		FIELD_SIZEOF(struct cvmx_bootmem_named_block_desc, field))
 
 /**
  * This function is the implementation of the get macros defined
Signature · 5 lines
2.17.1


-- 
Kees Cook
#1 lore raw
Quoted 4 lines · Kees Cook

In preparation for switching to a standard sizeof_member() macro to find the size of a member of a struct, remove the custom SIZEOF_FIELD() macro and use the more common FIELD_SIZEOF() instead. Later patches will globally replace FIELD_SIZEOF() and sizeof_field() with the more accurate sizeof_member().

Is the intent to have a single treewide flag day conversion of FIELD_SIZEOF -> sizeof_member or submit individual patches to subsystem maintainers?

I don't recall Linus buying in to either mechanism.