2010-06-28 11:54:56

by Kulikov Vasiliy

[permalink] [raw]
Subject: [PATCH 02/16] trivial: use ARRAY_SIZE

Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

Signed-off-by: Kulikov Vasiliy <[email protected]>
---
drivers/char/synclink_gt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 4561ce2..334cf5c 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
{
static unsigned short patterns[] =
{0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
- static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
+ static unsigned int count = ARRAY_SIZE(patterns);
unsigned int i;
int rc = 0;

--
1.7.0.4


2010-06-29 18:17:05

by Paul Fulghum

[permalink] [raw]
Subject: Re: [PATCH 02/16] trivial: use ARRAY_SIZE

On 6/28/2010 5:54 AM, Kulikov Vasiliy wrote:
> Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).
>
> Signed-off-by: Kulikov Vasiliy <[email protected]>
> ---
> drivers/char/synclink_gt.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
> index 4561ce2..334cf5c 100644
> --- a/drivers/char/synclink_gt.c
> +++ b/drivers/char/synclink_gt.c
> @@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
> {
> static unsigned short patterns[] =
> {0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
> - static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
> + static unsigned int count = ARRAY_SIZE(patterns);
> unsigned int i;
> int rc = 0;
>

Acked-by: Paul Fulghum <[email protected]>

with the exception of the trailing CR :-)

--
Paul Fulghum
MicroGate Systems, Ltd.

2010-06-30 20:49:38

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH 02/16] trivial: use ARRAY_SIZE

On Mon, 28 Jun 2010 15:54:48 +0400
Kulikov Vasiliy <[email protected]> wrote:

> static unsigned short patterns[] =
> {0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};

Unrelated, but these patterns should be const.

2010-07-20 15:04:33

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 02/16] trivial: use ARRAY_SIZE

On Tue, 29 Jun 2010, Paul Fulghum wrote:

> > Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).
> >
> > Signed-off-by: Kulikov Vasiliy <[email protected]>
> > ---
> > drivers/char/synclink_gt.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
> > index 4561ce2..334cf5c 100644
> > --- a/drivers/char/synclink_gt.c
> > +++ b/drivers/char/synclink_gt.c
> > @@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
> > {
> > static unsigned short patterns[] =
> > {0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
> > - static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
> > + static unsigned int count = ARRAY_SIZE(patterns);
> > unsigned int i;
> > int rc = 0;
> >
>
> Acked-by: Paul Fulghum <[email protected]>

The patch is not in linux-next as of today. Applied, thanks guys.

--
Jiri Kosina
SUSE Labs, Novell Inc.