netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 01/17] drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF
@ 2008-03-04 23:19 akpm
  2008-03-26  4:36 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2008-03-04 23:19 UTC (permalink / raw)
  To: jeff; +Cc: netdev, akpm, julia

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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 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_sizeof drivers/net/mv643xx_eth.c
--- a/drivers/net/mv643xx_eth.c~drivers-net-mv643xx_ethc-use-field_sizeof
+++ a/drivers/net/mv643xx_eth.c
@@ -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[] = {
_

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

* Re: [patch 01/17] drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF
  2008-03-04 23:19 [patch 01/17] drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF akpm
@ 2008-03-26  4:36 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2008-03-26  4:36 UTC (permalink / raw)
  To: akpm; +Cc: netdev, julia

akpm@linux-foundation.org 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.
> 
> 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>
> ---
> 
>  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_sizeof drivers/net/mv643xx_eth.c
> --- a/drivers/net/mv643xx_eth.c~drivers-net-mv643xx_ethc-use-field_sizeof
> +++ a/drivers/net/mv643xx_eth.c
> @@ -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[] = {
> _
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

applied



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

end of thread, other threads:[~2008-03-26  4:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 23:19 [patch 01/17] drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF akpm
2008-03-26  4:36 ` Jeff Garzik

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).