linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle: remove redundant check in cpuidle_switch_governor
@ 2022-08-29  1:15 Yu Liao
  2022-09-03 18:15 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Liao @ 2022-08-29  1:15 UTC (permalink / raw)
  To: rafael, daniel.lezcano; +Cc: linux-pm, linux-kernel, liaoyu15, liwei391

gov has already been NULL checked at the beginning of
cpuidle_switch_governor, so remove redundant check.

And use pr_info instead printk to fix the following checkpatch warning.

WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...

Signed-off-by: Yu Liao <liaoyu15@huawei.com>
---
 drivers/cpuidle/governor.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c
index 29acaf48e575..9e6865edb942 100644
--- a/drivers/cpuidle/governor.c
+++ b/drivers/cpuidle/governor.c
@@ -63,12 +63,10 @@ int cpuidle_switch_governor(struct cpuidle_governor *gov)
 
 	cpuidle_curr_governor = gov;
 
-	if (gov) {
-		list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
-			cpuidle_enable_device(dev);
-		cpuidle_install_idle_handler();
-		printk(KERN_INFO "cpuidle: using governor %s\n", gov->name);
-	}
+	list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
+		cpuidle_enable_device(dev);
+	cpuidle_install_idle_handler();
+	pr_info("cpuidle: using governor %s\n", gov->name);
 
 	return 0;
 }
-- 
2.25.1


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

* Re: [PATCH] cpuidle: remove redundant check in cpuidle_switch_governor
  2022-08-29  1:15 [PATCH] cpuidle: remove redundant check in cpuidle_switch_governor Yu Liao
@ 2022-09-03 18:15 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-09-03 18:15 UTC (permalink / raw)
  To: Yu Liao
  Cc: Rafael J. Wysocki, Daniel Lezcano, Linux PM,
	Linux Kernel Mailing List, liwei391

On Mon, Aug 29, 2022 at 3:08 AM Yu Liao <liaoyu15@huawei.com> wrote:
>
> gov has already been NULL checked at the beginning of
> cpuidle_switch_governor, so remove redundant check.
>
> And use pr_info instead printk to fix the following checkpatch warning.
>
> WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
> dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
>
> Signed-off-by: Yu Liao <liaoyu15@huawei.com>
> ---
>  drivers/cpuidle/governor.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c
> index 29acaf48e575..9e6865edb942 100644
> --- a/drivers/cpuidle/governor.c
> +++ b/drivers/cpuidle/governor.c
> @@ -63,12 +63,10 @@ int cpuidle_switch_governor(struct cpuidle_governor *gov)
>
>         cpuidle_curr_governor = gov;
>
> -       if (gov) {
> -               list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
> -                       cpuidle_enable_device(dev);
> -               cpuidle_install_idle_handler();
> -               printk(KERN_INFO "cpuidle: using governor %s\n", gov->name);
> -       }
> +       list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
> +               cpuidle_enable_device(dev);
> +       cpuidle_install_idle_handler();
> +       pr_info("cpuidle: using governor %s\n", gov->name);
>
>         return 0;
>  }
> --

Applied (with some minor modifications) as 6.1 material, thanks!

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

end of thread, other threads:[~2022-09-03 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29  1:15 [PATCH] cpuidle: remove redundant check in cpuidle_switch_governor Yu Liao
2022-09-03 18:15 ` 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).