diff mbox

[1/16,v2] sound/soc/pxa/mioa701_wm9713.c: Avoid using ARRAY_AND_SIZE(e) as a function argument

Message ID 1376340564-7975-1-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Julia Lawall Aug. 12, 2013, 8:49 p.m. UTC
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.

Comments

Mark Brown Aug. 12, 2013, 9:40 p.m. UTC | #1
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?
Julia Lawall Aug. 13, 2013, 4:52 a.m. UTC | #2
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
Mark Brown Aug. 13, 2013, 10:11 a.m. UTC | #3
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.
Mark Brown Aug. 14, 2013, 7:10 p.m. UTC | #4
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.
diff mbox

Patch

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