[PATCH 2.6.20] s390-drivers: Use ARRAY_SIZE macro when appropriate

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ahmed S. Darwish
Date: Tuesday, February 6, 2007 - 9:07 am

Hi all,

A patch to use ARRAY_SIZE macro already defined in kernel.h

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
---
Not compile tested due to (ofcourse ;)) missing hardware.

diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c
index f172759..997f468 100644
--- a/drivers/s390/cio/device_id.c
+++ b/drivers/s390/cio/device_id.c
@@ -11,6 +11,7 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 
 #include <asm/ccwdev.h>
 #include <asm/delay.h>
@@ -138,7 +139,7 @@ VM_virtual_device_info (__u16 devno, struct senseid *ps)
 		ps->cu_model = 0x60;
 		return;
 	}
-	for (i = 0; i < sizeof(vm_devices) / sizeof(vm_devices[0]); i++)
+	for (i = 0; i < ARRAY_SIZE(vm_devices); i++)
 		if (diag_data.vrdcvcla == vm_devices[i].vrdcvcla &&
 		    diag_data.vrdcvtyp == vm_devices[i].vrdcvtyp) {
 			ps->cu_type = vm_devices[i].cu_type;


-- 
Ahmed S. Darwish
http://darwish-07.blogspot.com
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00] A series of patches to use ARRAY_SIZE macro, Ahmed S. Darwish, (Tue Feb 6, 9:02 am)
[PATCH 2.6.20] DVB: Use ARRAY_SIZE macro when appropriate, Ahmed S. Darwish, (Tue Feb 6, 9:03 am)
[PATCH 2.6.20] KVM: Use ARRAY_SIZE macro when appropriate, Ahmed S. Darwish, (Tue Feb 6, 9:03 am)
[PATCH 2.6.20] atm: Use ARRAY_SIZE macro when appropriate, Ahmed S. Darwish, (Tue Feb 6, 9:06 am)
[PATCH 2.6.20] s390-drivers: Use ARRAY_SIZE macro when app ..., Ahmed S. Darwish, (Tue Feb 6, 9:07 am)
[PATCH 2.6.20] w1: Use ARRAY_SIZE macro when appropriate, Ahmed S. Darwish, (Tue Feb 6, 9:09 am)
[PATCH 2.6.20] drm: Use ARRAY_SIZE macro when appropriate, Ahmed S. Darwish, (Tue Feb 6, 9:10 am)
Re: [PATCH 2.6.20] w1: Use ARRAY_SIZE macro when appropriate, Evgeniy Polyakov, (Tue Feb 6, 9:19 am)
Re: [PATCH 2.6.20] isdn-capi: Use ARRAY_SIZE macro when ap ..., Philippe De Muyter, (Tue Feb 6, 2:18 pm)
Re: [PATCH 2.6.20] isdn-capi: Use ARRAY_SIZE macro when ap ..., Philippe De Muyter, (Wed Feb 7, 2:02 pm)