LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 6/8] drivers/net/igb: Use FIELD_SIZEOF
@ 2008-02-10 20:14 Julia Lawall
  2008-02-11 17:15 ` [E1000-devel] " Kok, Auke
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2008-02-10 20:14 UTC (permalink / raw)
  To: e1000-devel; +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/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
--- a/drivers/net/igb/igb_ethtool.c 2008-02-02 15:28:20.000000000 +0100
+++ b/drivers/net/igb/igb_ethtool.c 2008-02-10 18:06:35.000000000 +0100
@@ -43,7 +43,7 @@ struct igb_stats {
 	int stat_offset;
 };
 
-#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \
+#define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \
 		      offsetof(struct igb_adapter, m)
 static const struct igb_stats igb_gstrings_stats[] = {
 	{ "rx_packets", IGB_STAT(stats.gprc) },

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [E1000-devel] [PATCH 6/8] drivers/net/igb: Use FIELD_SIZEOF
  2008-02-10 20:14 [PATCH 6/8] drivers/net/igb: Use FIELD_SIZEOF Julia Lawall
@ 2008-02-11 17:15 ` Kok, Auke
  0 siblings, 0 replies; 2+ messages in thread
From: Kok, Auke @ 2008-02-11 17:15 UTC (permalink / raw)
  To: Julia Lawall; +Cc: e1000-devel, kernel-janitors, linux-kernel

Julia Lawall wrote:
> 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.


thanks for the (3) patches, I'll make sure they get merged.

Cheers,

Auke


> 
> 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/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
> --- a/drivers/net/igb/igb_ethtool.c 2008-02-02 15:28:20.000000000 +0100
> +++ b/drivers/net/igb/igb_ethtool.c 2008-02-10 18:06:35.000000000 +0100
> @@ -43,7 +43,7 @@ struct igb_stats {
>  	int stat_offset;
>  };
>  
> -#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \
> +#define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \
>  		      offsetof(struct igb_adapter, m)
>  static const struct igb_stats igb_gstrings_stats[] = {
>  	{ "rx_packets", IGB_STAT(stats.gprc) },
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> E1000-devel mailing list
> E1000-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/e1000-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-11 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-10 20:14 [PATCH 6/8] drivers/net/igb: Use FIELD_SIZEOF Julia Lawall
2008-02-11 17:15 ` [E1000-devel] " Kok, Auke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).