drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF
Subsystems (2)
PATCH 1/17 drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF
From: Julia Lawall <[email protected]>
Robert P.J. Day proposed to use the macro FIELD_SIZEOF in replace of code that matches its definition.
The modification was made using the following semantic patch
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@haskernel@
@@
#include <linux/kernel.h>
@depends on haskernel@
type t;
identifier f;
@@
- (sizeof(((t*)0)->f))
+ FIELD_SIZEOF(t, f)
@depends on haskernel@
type t;
identifier f;
@@
- sizeof(((t*)0)->f)
+ FIELD_SIZEOF(t, f)
// </smpl>
---
drivers/net/mv643xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mv643xx_eth.c renamed from drivers/net/mv643xx_eth.c~drivers-net-mv643xx_ethc-use-field_sizeof +1 -1
@@ -3155,7 +3155,7 @@ struct mv643xx_stats {int stat_offset; }; -#define MV643XX_STAT (m) sizeof(((struct mv643xx_private *)0)->m), \ +#define MV643XX_STAT (m) FIELD_SIZEOF(struct mv643xx_private, m), \ offsetof(struct mv643xx_private, m)static const struct mv643xx_stats mv643xx_gstrings_stats[] = {
_
Jeff Garzik
AppliedQuoted 50 lines · [email protected] wrote:
From: Julia Lawall <[email protected]>
Robert P.J. Day proposed to use the macro
FIELD_SIZEOFin replace of code that matches its definition.The modification was made using the following semantic patch
(http://www.emn.fr/x-info/coccinelle/)// <smpl>
@haskernel@
@@#include <
linux/kernel.h>@depends on haskernel@
type t;
identifier f;
@@- (sizeof(((t*)0)->f))
+FIELD_SIZEOF(t, f)@depends on haskernel@
type t;
identifier f;
@@- sizeof(((t*)0)->f)
+FIELD_SIZEOF(t, f)
// </smpl>Signed-off-by Julia Lawall <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/net/mv643xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -puN
drivers/net/mv643xx_eth.c~drivers-net-mv643xx_ethc-use-field_sizeofdrivers/net/mv643xx_eth.cdrivers/net/mv643xx_eth.c renamed from drivers/net/mv643xx_eth.c~drivers-net-mv643xx_ethc-use-field_sizeof +1
-1@@ -3155,7 +3155,7 @@ struct mv643xx_stats {int stat_offset; }; -#define MV643XX_STAT (m) sizeof(((struct mv643xx_private *)0)->m), \ +#define MV643XX_STAT (m) FIELD_SIZEOF(struct mv643xx_private, m), \ offsetof(struct mv643xx_private, m)static const struct mv643xx_stats mv643xx_gstrings_stats[] = {
Quoted 5 lines
_
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
applied