public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argument
@ 2013-08-12 20:49 Julia Lawall
  2013-08-12 21:40 ` [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu Mark Brown
  2013-08-14 19:10 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2013-08-12 20:49 UTC (permalink / raw)
  To: Eric Miao, robert.jarzmik
  Cc: kernel-janitors, Russell King, Haojian Zhuang, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, linux-arm-kernel,
	alsa-devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Replace ARRAY_AND_SIZE(e) in function argument position to avoid hiding the
arity of the called function.

At the suggestion of Robert Jarzmik, this additionally removes the
definition of ARRAY_AND_SIZE, which is not used elsewhere in the file.

The semantic match that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,f;
@@

f(...,
- ARRAY_AND_SIZE(e)
+ e,ARRAY_SIZE(e)
  ,...)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
Not compiled.
v2 removes the definition of ARRAY_AND_SIZE.

diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c
index 97b711e..bbea778 100644
--- a/sound/soc/pxa/mioa701_wm9713.c
+++ b/sound/soc/pxa/mioa701_wm9713.c
@@ -56,8 +56,6 @@
 #include "pxa2xx-ac97.h"
 #include "../codecs/wm9713.h"
 
-#define ARRAY_AND_SIZE(x)	(x), ARRAY_SIZE(x)
-
 #define AC97_GPIO_PULL		0x58
 
 /* Use GPIO8 for rear speaker amplifier */
@@ -133,10 +131,11 @@ static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
 	unsigned short reg;
 
 	/* Add mioa701 specific widgets */
-	snd_soc_dapm_new_controls(dapm, ARRAY_AND_SIZE(mioa701_dapm_widgets));
+	snd_soc_dapm_new_controls(dapm, mioa701_dapm_widgets,
+				  ARRAY_SIZE(mioa701_dapm_widgets));
 
 	/* Set up mioa701 specific audio path audio_mapnects */
-	snd_soc_dapm_add_routes(dapm, ARRAY_AND_SIZE(audio_map));
+	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
 
 	/* Prepare GPIO8 for rear speaker amplifier */
 	reg = codec->driver->read(codec, AC97_GPIO_CFG);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu
  2013-08-12 20:49 [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argument Julia Lawall
@ 2013-08-12 21:40 ` Mark Brown
  2013-08-13  4:52   ` Julia Lawall
  2013-08-14 19:10 ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-08-12 21:40 UTC (permalink / raw)
  To: Julia Lawall
  Cc: alsa-devel, Eric Miao, Takashi Iwai, linux-kernel,
	kernel-janitors, Liam Girdwood, Haojian Zhuang, Russell King,
	robert.jarzmik, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

On Mon, Aug 12, 2013 at 10:49:24PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Replace ARRAY_AND_SIZE(e) in function argument position to avoid hiding the
> arity of the called function.

What is the difference between this and the patch I applied the other
day?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu
  2013-08-12 21:40 ` [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu Mark Brown
@ 2013-08-13  4:52   ` Julia Lawall
  2013-08-13 10:11     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2013-08-13  4:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Julia Lawall, Eric Miao, robert.jarzmik, kernel-janitors,
	Russell King, Haojian Zhuang, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, linux-arm-kernel, alsa-devel, linux-kernel

On Mon, 12 Aug 2013, Mark Brown wrote:

> On Mon, Aug 12, 2013 at 10:49:24PM +0200, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > 
> > Replace ARRAY_AND_SIZE(e) in function argument position to avoid hiding the
> > arity of the called function.
> 
> What is the difference between this and the patch I applied the other
> day?

Sorry, it should have also removed the local definition of ARRAY_AND_SIZE?  
I thought that was in the commit message.

julia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu
  2013-08-13  4:52   ` Julia Lawall
@ 2013-08-13 10:11     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-08-13 10:11 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Eric Miao, robert.jarzmik, kernel-janitors, Russell King,
	Haojian Zhuang, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	linux-arm-kernel, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On Tue, Aug 13, 2013 at 06:52:56AM +0200, Julia Lawall wrote:
> On Mon, 12 Aug 2013, Mark Brown wrote:

> > What is the difference between this and the patch I applied the other
> > day?

> Sorry, it should have also removed the local definition of ARRAY_AND_SIZE?  
> I thought that was in the commit message.

It was, sorry - to be hoenst I didn't read beyond the first paragraph
since I'd already applied the patch.  If a patch has been applied you
should really send incremental updates rather than resending the patch.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu
  2013-08-12 20:49 [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argument Julia Lawall
  2013-08-12 21:40 ` [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu Mark Brown
@ 2013-08-14 19:10 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-08-14 19:10 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Eric Miao, robert.jarzmik, kernel-janitors, Russell King,
	Haojian Zhuang, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	linux-arm-kernel, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

On Mon, Aug 12, 2013 at 10:49:24PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Replace ARRAY_AND_SIZE(e) in function argument position to avoid hiding the
> arity of the called function.

Applied the incremental bit of this, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-14 19:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-12 20:49 [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argument Julia Lawall
2013-08-12 21:40 ` [PATCH 1/16 v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argu Mark Brown
2013-08-13  4:52   ` Julia Lawall
2013-08-13 10:11     ` Mark Brown
2013-08-14 19:10 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox