LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] arch/ppc: Use FIELD_SIZEOF
@ 2008-02-10 20:07 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2008-02-10 20:07 UTC (permalink / raw)
  To: paulus, linuxppc-dev

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/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
--- a/arch/ppc/8xx_io/commproc.c 2008-02-02 15:28:16.000000000 +0100
+++ b/arch/ppc/8xx_io/commproc.c 2008-02-10 17:36:23.000000000 +0100
@@ -43,7 +43,7 @@
 ({									\
 	u32 offset = offsetof(immap_t, member);				\
 	void *addr = ioremap (IMAP_ADDR + offset,			\
-			      sizeof( ((immap_t*)0)->member));		\
+			      FIELD_SIZEOF(immap_t, member));		\
 	addr;								\
 })
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-10 20:37 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:07 [PATCH 1/8] arch/ppc: 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