[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0802102108000.23906@ask.diku.dk>
Date: Sun, 10 Feb 2008 21:08:49 +0100 (CET)
From: Julia Lawall <julia@...u.dk>
To: sfr@...b.auug.org.au, axboe@...nel.dk
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 2/8] drivers/block: Use FIELD_SIZEOF
From: Julia Lawall <julia@...u.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@...u.dk>
---
diff -u -p a/drivers/block/viodasd.c b/drivers/block/viodasd.c
--- a/drivers/block/viodasd.c 2008-02-02 15:28:17.000000000 +0100
+++ b/drivers/block/viodasd.c 2008-02-10 17:42:42.000000000 +0100
@@ -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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists