Skip to content

Commit

Permalink
[POWERPC] Use FIELD_SIZEOF in drivers/block/viodasd.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Paul Mackerras committed Apr 1, 2008
1 parent 1d18a60 commit ea6728c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/viodasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ea6728c

Please sign in to comment.