[PATCH 2.6.20] isdn-capi: 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:04 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>
---
 capi.c    |    4 ++--
 capidrv.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index d22c022..3804591 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1456,7 +1456,7 @@ static struct procfsentries {
 
 static void __init proc_init(void)
 {
-    int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]);
+    int nelem = ARRAY_SIZE(procfsentries);
     int i;
 
     for (i=0; i < nelem; i++) {
@@ -1468,7 +1468,7 @@ static void __init proc_init(void)
 
 static void __exit proc_exit(void)
 {
-    int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]);
+    int nelem = ARRAY_SIZE(procfsentries);
     int i;
 
     for (i=nelem-1; i >= 0; i--) {
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index c4d438c..8cec9c3 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -2218,7 +2218,7 @@ static struct procfsentries {
 
 static void __init proc_init(void)
 {
-    int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]);
+    int nelem = ARRAY_SIZE(procfsentries);
     int i;
 
     for (i=0; i < nelem; i++) {
@@ -2230,7 +2230,7 @@ static void __init proc_init(void)
 
 static void __exit proc_exit(void)
 {
-    int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]);
+    int nelem = ARRAY_SIZE(procfsentries);
     int i;
 
     for (i=nelem-1; i >= 0; i--) {

-- 
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] isdn-capi: Use ARRAY_SIZE macro when approp ..., Ahmed S. Darwish, (Tue Feb 6, 9:04 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] 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)