Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF

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>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by

Julia Lawall and committed by
Jeff Garzik
7a6d84c1 ef11291b

+1 -1
+1 -1
drivers/net/mv643xx_eth.c
··· 3156 3156 int stat_offset; 3157 3157 }; 3158 3158 3159 - #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ 3159 + #define MV643XX_STAT(m) FIELD_SIZEOF(struct mv643xx_private, m), \ 3160 3160 offsetof(struct mv643xx_private, m) 3161 3161 3162 3162 static const struct mv643xx_stats mv643xx_gstrings_stats[] = {