linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
@ 2017-01-05  6:04 Viresh Kumar
  2017-01-05  6:04 ` [PATCH 2/2] cpufreq: Remove CPUFREQ_START notifier event Viresh Kumar
  2017-01-28 11:32 ` [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Rafael J. Wysocki
  0 siblings, 2 replies; 6+ messages in thread
From: Viresh Kumar @ 2017-01-05  6:04 UTC (permalink / raw)
  To: Rafael Wysocki, Len Brown
  Cc: linaro-kernel, linux-pm, linux-kernel, Vincent Guittot,
	Viresh Kumar, linux-acpi

acpi_processor_ppc_notifier() can live without using CPUFREQ_START
(which is gonna be removed soon). 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;
+
 	if (event != CPUFREQ_ADJUST)
 		return 0;
 
-- 
2.7.1.410.g6faf27b

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

* [PATCH 2/2] cpufreq: Remove CPUFREQ_START notifier event
  2017-01-05  6:04 [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Viresh Kumar
@ 2017-01-05  6:04 ` Viresh Kumar
  2017-01-28 11:32 ` [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Rafael J. Wysocki
  1 sibling, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2017-01-05  6:04 UTC (permalink / raw)
  To: Rafael Wysocki, Viresh Kumar
  Cc: linaro-kernel, linux-pm, linux-kernel, Vincent Guittot

Its not used anymore, remove it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c             | 3 ---
 drivers/cpufreq/ppc_cbe_cpufreq_pmi.c | 3 ---
 include/linux/cpufreq.h               | 1 -
 3 files changed, 7 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 53268bebdf1e..408479540566 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1246,9 +1246,6 @@ static int cpufreq_online(unsigned int cpu)
 		write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 	}
 
-	blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
-				     CPUFREQ_START, policy);
-
 	ret = cpufreq_init_policy(policy);
 	if (ret) {
 		pr_err("%s: Failed to initialize policy for cpu: %d (%d)\n",
diff --git a/drivers/cpufreq/ppc_cbe_cpufreq_pmi.c b/drivers/cpufreq/ppc_cbe_cpufreq_pmi.c
index dc112481a408..eeaa92251512 100644
--- a/drivers/cpufreq/ppc_cbe_cpufreq_pmi.c
+++ b/drivers/cpufreq/ppc_cbe_cpufreq_pmi.c
@@ -100,9 +100,6 @@ static int pmi_notifier(struct notifier_block *nb,
 	/* Should this really be called for CPUFREQ_ADJUST and CPUFREQ_NOTIFY
 	 * policy events?)
 	 */
-	if (event == CPUFREQ_START)
-		return 0;
-
 	node = cbe_cpu_to_node(policy->cpu);
 
 	pr_debug("got notified, event=%lu, node=%u\n", event, node);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 0183986b3ba6..61009c0b82c8 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -415,7 +415,6 @@ static inline void cpufreq_resume(void) {}
 /* Policy Notifiers  */
 #define CPUFREQ_ADJUST			(0)
 #define CPUFREQ_NOTIFY			(1)
-#define CPUFREQ_START			(2)
 
 #ifdef CONFIG_CPU_FREQ
 int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
-- 
2.7.1.410.g6faf27b

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

* Re: [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
  2017-01-05  6:04 [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Viresh Kumar
  2017-01-05  6:04 ` [PATCH 2/2] cpufreq: Remove CPUFREQ_START notifier event Viresh Kumar
@ 2017-01-28 11:32 ` Rafael J. Wysocki
  2017-01-30  4:29   ` [PATCH V2 " Viresh Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2017-01-28 11:32 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Len Brown, linaro-kernel, linux-pm, linux-kernel,
	Vincent Guittot, linux-acpi

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

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

* [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
  2017-01-28 11:32 ` [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Rafael J. Wysocki
@ 2017-01-30  4:29   ` Viresh Kumar
  2017-01-30  7:07     ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2017-01-30  4:29 UTC (permalink / raw)
  To: Rafael Wysocki, Len Brown
  Cc: linaro-kernel, linux-pm, linux-kernel, Vincent Guittot,
	Viresh Kumar, linux-acpi

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

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

* Re: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
  2017-01-30  4:29   ` [PATCH V2 " Viresh Kumar
@ 2017-01-30  7:07     ` Rafael J. Wysocki
  2017-01-30  7:49       ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2017-01-30  7:07 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael Wysocki, Len Brown, Lists linaro-kernel, Linux PM,
	Linux Kernel Mailing List, Vincent Guittot,
	ACPI Devel Maling List

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

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

* Re: [PATCH V2 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START
  2017-01-30  7:07     ` Rafael J. Wysocki
@ 2017-01-30  7:49       ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2017-01-30  7:49 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Viresh Kumar, Rafael Wysocki, Len Brown, Lists linaro-kernel,
	Linux PM, Linux Kernel Mailing List, Vincent Guittot,
	ACPI Devel Maling List

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

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

end of thread, other threads:[~2017-01-30  7:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-05  6:04 [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Viresh Kumar
2017-01-05  6:04 ` [PATCH 2/2] cpufreq: Remove CPUFREQ_START notifier event Viresh Kumar
2017-01-28 11:32 ` [PATCH 1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START Rafael J. Wysocki
2017-01-30  4:29   ` [PATCH V2 " Viresh Kumar
2017-01-30  7:07     ` Rafael J. Wysocki
2017-01-30  7:49       ` Rafael J. Wysocki

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