Skip to content

Commit

Permalink
cpuidle: Remove redundant check in cpuidle_switch_governor()
Browse files Browse the repository at this point in the history
gov has already been NULL checked at the beginning of
cpuidle_switch_governor, so remove redundant check.

While at it, use pr_info() instead printk() to address 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>
[ rjw: Subject and changelog edits, added empty line after if () ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Yu Liao authored and Rafael J. Wysocki committed Sep 3, 2022
1 parent 0dbc0f4 commit 06f7c08
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/cpuidle/governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ 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;
}
Expand Down

0 comments on commit 06f7c08

Please sign in to comment.