Skip to contentSkip to conversation

isdn/capi: use ARRAY_SIZE when appropriate

PATCH In review Ahmed S. Darwish 2 participants 2 messages Jan 16, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 isdn/capi: use ARRAY_SIZE when appropriate

Hi all,

A trivial patch to use ARRAY_SIZE macro defined in kernel.h instead of reimplementing it.

---

capi.c    |    4 ++--
capidrv.c |    4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
drivers/isdn/capi/capi.c +2 -2
index d22c022..3804591 100644
@@ -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--) {
drivers/isdn/capi/capidrv.c +2 -2
index c4d438c..8cec9c3 100644
@@ -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--) {
Signature · 2 lines
Ahmed S. Darwish
http://darwish-07.blogspot.com
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ahmed S. Darwish

Hi all,

A trivial patch to use ARRAY_SIZE macro defined in kernel.h instead of reimplementing it.

Quoted 54 lines

---

capi.c    |    4 ++--
capidrv.c |    4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
drivers/isdn/capi/capi.c +2 -2
index d22c022..3804591 100644
@@ -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--) {
drivers/isdn/capi/capidrv.c +2 -2
index c4d438c..8cec9c3 100644
@@ -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--) {
Signature · 3 lines
-- 
Ahmed S. Darwish
http://darwish-07.blogspot.com
Signature · 3 lines
Karsten Keil
SuSE Labs
ISDN development