* [PATCH 4/8] : Use FIELD_SIZEOF
@ 2008-02-10 20:12 Julia Lawall
0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2008-02-10 20:12 UTC (permalink / raw)
To: e1000-devel, john.ronciak, jeffrey.t.kirsher
Cc: linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
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>
---
diff -u -p a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
--- a/drivers/net/ixgb/ixgb_ethtool.c 2007-11-08 18:33:36.000000000 +0100
+++ b/drivers/net/ixgb/ixgb_ethtool.c 2008-02-10 17:59:49.000000000 +0100
@@ -49,7 +49,7 @@ struct ixgb_stats {
int stat_offset;
};
-#define IXGB_STAT(m) sizeof(((struct ixgb_adapter *)0)->m), \
+#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
offsetof(struct ixgb_adapter, m)
static struct ixgb_stats ixgb_gstrings_stats[] = {
{"rx_packets", IXGB_STAT(net_stats.rx_packets)},
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-10 21:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-10 20:12 [PATCH 4/8] : Use FIELD_SIZEOF Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®