2007-01-16 09:53:44

by Ahmed S. Darwish

[permalink] [raw]
Subject: [PATCH 2.6.20-rc5] 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.

Signed-off-by: Ahmed S. Darwish <[email protected]>
---

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


2007-01-16 13:05:46

by Karsten Keil

[permalink] [raw]
Subject: Re: [PATCH 2.6.20-rc5] isdn/capi: use ARRAY_SIZE when appropriate

On Tue, Jan 16, 2007 at 11:53:19AM +0200, Ahmed S. Darwish wrote:
> Hi all,
>
> A trivial patch to use ARRAY_SIZE macro defined in kernel.h instead
> of reimplementing it.
>
> Signed-off-by: Ahmed S. Darwish <[email protected]>

Acked-by: Karsten Keil <[email protected]>

> ---
>
> 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

--
Karsten Keil
SuSE Labs
ISDN development