diff mbox series

[V2,1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START

Message ID e608c76ea40e4f0d50bfe821174dfebef924e35b.1485750547.git.viresh.kumar@linaro.org
State Accepted
Commit 7cb88d68eec1732e0b6bcdb92e8f46f424b69560
Headers show
Series [V2,1/2] ACPI: processor_perflib: Simplify code and stop using CPUFREQ_START | expand

Commit Message

Viresh Kumar Jan. 30, 2017, 4:29 a.m. UTC
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(-)

-- 
2.7.1.410.g6faf27b

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

Comments

Rafael J. Wysocki Jan. 30, 2017, 7:07 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

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;