diff mbox

[12/16] drivers/cpufreq/pxa3xx-cpufreq.c: Avoid using ARRAY_AND_SIZE(e) as a function argument

Message ID 1376239917-15594-13-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Julia Lawall Aug. 11, 2013, 4:51 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.

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.

 drivers/cpufreq/pxa3xx-cpufreq.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Viresh Kumar Aug. 12, 2013, 5:26 a.m. UTC | #1
On 11 August 2013 22:21, Julia Lawall <Julia.Lawall@lip6.fr> 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.

Makes sense.

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

What is this doing here?

> // <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.
>
>  drivers/cpufreq/pxa3xx-cpufreq.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julia Lawall Aug. 12, 2013, 5:45 a.m. UTC | #2
On Mon, 12 Aug 2013, Viresh Kumar wrote:

> On 11 August 2013 22:21, Julia Lawall <Julia.Lawall@lip6.fr> 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.
> 
> Makes sense.
> 
> > The semantic match that makes this change is as follows:
> > (http://coccinelle.lip6.fr/)
> 
> What is this doing here?

I'm not sure to understand the sense of the question.  The semantic patch 
explains exactly what considerations were used when making the 
transformation.  That is, any function call, having a call to 
ARRAY_AND_SIZE as an argument is rewritten to replace the call to 
ARRAY_AND_SIZE with the correspondingtwo arguments.  The transformation 
was performed entirely automatically, although in a lot of cases it was 
necessary to add newlines afterwards.

julia

> > // <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.
> >
> >  drivers/cpufreq/pxa3xx-cpufreq.c |    6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Aug. 12, 2013, 5:46 a.m. UTC | #3
On 12 August 2013 11:15, Julia Lawall <julia.lawall@lip6.fr> wrote:
> I'm not sure to understand the sense of the question.

I was talking about this :)

(http://coccinelle.lip6.fr/)
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julia Lawall Aug. 12, 2013, 5:48 a.m. UTC | #4
On Mon, 12 Aug 2013, Viresh Kumar wrote:

> On 12 August 2013 11:15, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > I'm not sure to understand the sense of the question.
> 
> I was talking about this :)
> 
> (http://coccinelle.lip6.fr/)

The URL of the tool if you can't figure out all the funny notation below.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Aug. 12, 2013, 5:50 a.m. UTC | #5
On 12 August 2013 11:18, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Mon, 12 Aug 2013, Viresh Kumar wrote:
>
>> On 12 August 2013 11:15, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> > I'm not sure to understand the sense of the question.
>>
>> I was talking about this :)
>>
>> (http://coccinelle.lip6.fr/)
>
> The URL of the tool if you can't figure out all the funny notation below.

Okay ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael Wysocki Aug. 13, 2013, 1:22 p.m. UTC | #6
On Sunday, August 11, 2013 06:51:53 PM 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.
> 
> 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>

Queued up for 3.12.

Thanks,
Rafael


> ---
> Not compiled.
> 
>  drivers/cpufreq/pxa3xx-cpufreq.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/pxa3xx-cpufreq.c b/drivers/cpufreq/pxa3xx-cpufreq.c
> index 9c92ef0..d26306f 100644
> --- a/drivers/cpufreq/pxa3xx-cpufreq.c
> +++ b/drivers/cpufreq/pxa3xx-cpufreq.c
> @@ -213,10 +213,12 @@ static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)
>  	policy->cur = policy->min = policy->max;
>  
>  	if (cpu_is_pxa300() || cpu_is_pxa310())
> -		ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa300_freqs));
> +		ret = setup_freqs_table(policy, pxa300_freqs,
> +					ARRAY_SIZE(pxa300_freqs));
>  
>  	if (cpu_is_pxa320())
> -		ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa320_freqs));
> +		ret = setup_freqs_table(policy, pxa320_freqs,
> +					ARRAY_SIZE(pxa320_freqs));
>  
>  	if (ret) {
>  		pr_err("failed to setup frequency table\n");
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/cpufreq/pxa3xx-cpufreq.c b/drivers/cpufreq/pxa3xx-cpufreq.c
index 9c92ef0..d26306f 100644
--- a/drivers/cpufreq/pxa3xx-cpufreq.c
+++ b/drivers/cpufreq/pxa3xx-cpufreq.c
@@ -213,10 +213,12 @@  static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)
 	policy->cur = policy->min = policy->max;
 
 	if (cpu_is_pxa300() || cpu_is_pxa310())
-		ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa300_freqs));
+		ret = setup_freqs_table(policy, pxa300_freqs,
+					ARRAY_SIZE(pxa300_freqs));
 
 	if (cpu_is_pxa320())
-		ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa320_freqs));
+		ret = setup_freqs_table(policy, pxa320_freqs,
+					ARRAY_SIZE(pxa320_freqs));
 
 	if (ret) {
 		pr_err("failed to setup frequency table\n");