[POWERPC] Use FIELD_SIZEOF in drivers/block/viodasd.c
authorJulia Lawall <julia@diku.dk>
Fri, 28 Mar 2008 21:21:08 +0000 (08:21 +1100)
committerPaul Mackerras <paulus@samba.org>
Tue, 1 Apr 2008 09:43:10 +0000 (20:43 +1100)
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>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
drivers/block/viodasd.c

index 41ca721d2523fec5987e02db1e9e7a26f35f60bb..ebfe038d859ee47fe494198be34ffba8880d3b7e 100644 (file)
@@ -69,7 +69,7 @@ MODULE_LICENSE("GPL");
 enum {
        PARTITION_SHIFT = 3,
        MAX_DISKNO = HVMAXARCHITECTEDVIRTUALDISKS,
-       MAX_DISK_NAME = sizeof(((struct gendisk *)0)->disk_name)
+       MAX_DISK_NAME = FIELD_SIZEOF(struct gendisk, disk_name)
 };
 
 static DEFINE_SPINLOCK(viodasd_spinlock);