Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1568870 > unrolled thread

Re: [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2017-01-28 12:40 +0100
Last post2017-01-30 09:00 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-01-28 12:40 +0100
    [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Viresh Kumar <viresh.kumar@linaro.org> - 2017-01-30 05:40 +0100
      Re: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop  using CPUFREQ_START "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-30 08:20 +0100
        Re: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop  using CPUFREQ_START "Rafael J. Wysocki" <rafael@kernel.org> - 2017-01-30 09:00 +0100

#1568870 — Re: [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-01-28 12:40 +0100
SubjectRe: [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
Message-ID<t4zwm-Ot-3@gated-at.bofh.it>
On Thursday, January 05, 2017 11:34:30 AM Viresh Kumar wrote:
> acpi_processor_ppc_notifier() can live without using CPUFREQ_START
> (which is gonna be removed soon).

That should be "acpi_processor_ppc_notifier() can live without using CPUFREQ_START ...,
because X".

X is obviously missing.

> Simplify it a bit.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Rebased over: https://marc.info/?l=linux-kernel&m=148359167516831&w=2
> 
>  drivers/acpi/processor_perflib.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
> index f0b4a981b8d3..1ceea1143a1c 100644
> --- a/drivers/acpi/processor_perflib.c
> +++ b/drivers/acpi/processor_perflib.c
> @@ -75,14 +75,12 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
>  	struct acpi_processor *pr;
>  	unsigned int ppc = 0;
>  
> -	if (event == CPUFREQ_START && ignore_ppc <= 0) {
> -		ignore_ppc = 0;
> -		return 0;
> -	}
> -
>  	if (ignore_ppc)
>  		return 0;
>  
> +	if (ignore_ppc < 0)
> +		ignore_ppc = 0;
> +

And the above looks like dead code to me (we have returned already if ignore_ppc
is negative), so in particular ignore_ppc is never going to become 0 when it was
negative initially.

>  	if (event != CPUFREQ_ADJUST)
>  		return 0;
>  
> 

Thanks,
Rafael

[toc] | [next] | [standalone]


#1569378 — [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-01-30 05:40 +0100
Subject[PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
Message-ID<t5bUZ-7TO-1@gated-at.bofh.it>
In reply to#1568870
acpi_processor_ppc_notifier() can live without using CPUFREQ_START
(which is gonna be removed soon), as it is only used while setting
ignore_ppc to 0. This can be done with the help of "ignore_ppc < 0"
check alone. The notifier function anyway ignores all events except
CPUFREQ_ADJUST and dropping CPUFREQ_START wouldn't harm at all.

Once CPUFREQ_START event is removed from the cpufreq core,
acpi_processor_ppc_notifier() will get called only for CPUFREQ_NOTIFY or
CPUFREQ_ADJUST event. Drop the return statement from the first if block
to make sure we don't ignore any such events.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
V1->V2:
- Improved changelog
- Don't move the first if block to a later point, as it becomes useless
  then.
---
 drivers/acpi/processor_perflib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index f0b4a981b8d3..18b72eec3507 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -75,10 +75,8 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
 	struct acpi_processor *pr;
 	unsigned int ppc = 0;
 
-	if (event == CPUFREQ_START && ignore_ppc <= 0) {
+	if (ignore_ppc < 0)
 		ignore_ppc = 0;
-		return 0;
-	}
 
 	if (ignore_ppc)
 		return 0;
-- 
2.7.1.410.g6faf27b

[toc] | [prev] | [next] | [standalone]


#1569433 — Re: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-01-30 08:20 +0100
SubjectRe: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
Message-ID<t5epP-15B-9@gated-at.bofh.it>
In reply to#1569378
On Mon, Jan 30, 2017 at 5:29 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> acpi_processor_ppc_notifier() can live without using CPUFREQ_START
> (which is gonna be removed soon), as it is only used while setting
> ignore_ppc to 0. This can be done with the help of "ignore_ppc < 0"
> check alone. The notifier function anyway ignores all events except
> CPUFREQ_ADJUST and dropping CPUFREQ_START wouldn't harm at all.
>
> Once CPUFREQ_START event is removed from the cpufreq core,
> acpi_processor_ppc_notifier() will get called only for CPUFREQ_NOTIFY or
> CPUFREQ_ADJUST event. Drop the return statement from the first if block
> to make sure we don't ignore any such events.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> ---
> V1->V2:
> - Improved changelog
> - Don't move the first if block to a later point, as it becomes useless
>   then.
> ---
>  drivers/acpi/processor_perflib.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
> index f0b4a981b8d3..18b72eec3507 100644
> --- a/drivers/acpi/processor_perflib.c
> +++ b/drivers/acpi/processor_perflib.c
> @@ -75,10 +75,8 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
>         struct acpi_processor *pr;
>         unsigned int ppc = 0;
>
> -       if (event == CPUFREQ_START && ignore_ppc <= 0) {
> +       if (ignore_ppc < 0)
>                 ignore_ppc = 0;
> -               return 0;
> -       }

Don't we want to return from here if ignore_ppc is 0?

>
>         if (ignore_ppc)
>                 return 0;
> --

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1569445 — Re: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-01-30 09:00 +0100
SubjectRe: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
Message-ID<t5f2x-1hX-3@gated-at.bofh.it>
In reply to#1569433
On Mon, Jan 30, 2017 at 8:07 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Mon, Jan 30, 2017 at 5:29 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> acpi_processor_ppc_notifier() can live without using CPUFREQ_START
>> (which is gonna be removed soon), as it is only used while setting
>> ignore_ppc to 0. This can be done with the help of "ignore_ppc < 0"
>> check alone. The notifier function anyway ignores all events except
>> CPUFREQ_ADJUST and dropping CPUFREQ_START wouldn't harm at all.
>>
>> Once CPUFREQ_START event is removed from the cpufreq core,
>> acpi_processor_ppc_notifier() will get called only for CPUFREQ_NOTIFY or
>> CPUFREQ_ADJUST event. Drop the return statement from the first if block
>> to make sure we don't ignore any such events.
>>
>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>
>> ---
>> V1->V2:
>> - Improved changelog
>> - Don't move the first if block to a later point, as it becomes useless
>>   then.
>> ---
>>  drivers/acpi/processor_perflib.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
>> index f0b4a981b8d3..18b72eec3507 100644
>> --- a/drivers/acpi/processor_perflib.c
>> +++ b/drivers/acpi/processor_perflib.c
>> @@ -75,10 +75,8 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
>>         struct acpi_processor *pr;
>>         unsigned int ppc = 0;
>>
>> -       if (event == CPUFREQ_START && ignore_ppc <= 0) {
>> +       if (ignore_ppc < 0)
>>                 ignore_ppc = 0;
>> -               return 0;
>> -       }
>
> Don't we want to return from here if ignore_ppc is 0?

I actually wanted to say "was negative" here, not sure why I said the
above in the end.

Anyway, the patch looks correct now.

Thanks,
Rafael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web