linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: joe@perches.com (Joe Perches)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arch/arm/mach-pxa/stargate2.c: use ARRAY_AND_SIZE consistently
Date: Sat, 10 Aug 2013 08:59:46 -0700	[thread overview]
Message-ID: <1376150386.2083.26.camel@joe-AO722> (raw)
In-Reply-To: <alpine.DEB.2.02.1308101735060.2076@localhost6.localdomain6>

On Sat, 2013-08-10 at 17:38 +0200, Julia Lawall wrote:
> On Sat, 10 Aug 2013, Joe Perches wrote:
> > On Sat, 2013-08-10 at 17:25 +0200, Julia Lawall wrote:
> > > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > > Because ARRAY_AND_SIZE changes the apparent arity of a function, if it is
> > > used for one call to a given function, it would be better, if possible, to
> > > use it for all of them.
> > I think it'd be better to remove ARRAY_AND_SIZE instead.
> 
> I can do that, if it is wanted, but there are over 200 uses, and I think 
> it is a little bit positive in that it ensures that the array is passed 
> along with its own size.

Maybe, but if it's generally accepted that it's useful,
and I'm a little dubious because it does hide argument
count in functions where it's used, the 6 #defines should
be centralized in kernel.h

$ git grep "define.*ARRAY_AND_SIZE"
arch/arm/mach-kirkwood/common.h:#define ARRAY_AND_SIZE(x)       (x), ARRAY_SIZE(x)
arch/arm/mach-mmp/common.h:#define ARRAY_AND_SIZE(x)    (x), ARRAY_SIZE(x)
arch/arm/mach-pxa/generic.h:#define ARRAY_AND_SIZE(x)   (x), ARRAY_SIZE(x)
arch/arm/mach-ux500/db8500-regs.h:#define ARRAY_AND_SIZE(x)     (x), ARRAY_SIZE(x)
drivers/pinctrl/pinctrl-lantiq.h:#define ARRAY_AND_SIZE(x)      (x), ARRAY_SIZE(x)
sound/soc/pxa/mioa701_wm9713.c:#define ARRAY_AND_SIZE(x)        (x), ARRAY_SIZE(x)

A small counter-argument against using ARRAY_AND_SIZE:

clkdev_add_table has 60+ uses, only 6 of those with
ARRAY_AND_SIZE.

I think it makes it difficult to do some cocinelle/spatch
transform on clkdev_add_table.

  reply	other threads:[~2013-08-10 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-10 15:25 [PATCH] arch/arm/mach-pxa/stargate2.c: use ARRAY_AND_SIZE consistently Julia Lawall
2013-08-10 15:32 ` Joe Perches
2013-08-10 15:38   ` Julia Lawall
2013-08-10 15:59     ` Joe Perches [this message]
2013-08-10 17:49   ` walter harms
2013-08-10 22:33 ` Dan Carpenter
2013-08-11  5:48   ` Julia Lawall
2013-08-11  7:34     ` walter harms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376150386.2083.26.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).