Re: [PATCH 3/3] thermal: intel: hfi: Enable interface only when required
From: Stanislaw Gruszka <hidden>
Date: 2024-02-01 13:20:09
Also in:
linux-pm
From: Stanislaw Gruszka <hidden>
Date: 2024-02-01 13:20:09
Also in:
linux-pm
On Wed, Jan 31, 2024 at 05:48:08PM -0800, Ricardo Neri wrote:
quoted
drivers/thermal/intel/intel_hfi.c | 82 +++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 9 deletions(-)diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index 3b04c6ec4fca..50601f75f6dc 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c@@ -30,6 +30,7 @@ #include <linux/kernel.h> #include <linux/math.h> #include <linux/mutex.h> +#include <linux/netlink.h> #include <linux/percpu-defs.h> #include <linux/printk.h> #include <linux/processor.h>@@ -480,7 +481,8 @@ void intel_hfi_online(unsigned int cpu) /* Enable this HFI instance if this is its first online CPU. */ if (cpumask_weight(hfi_instance->cpus) == 1) { hfi_set_hw_table(hfi_instance); - hfi_enable(); + if (thermal_group_has_listeners(THERMAL_GENL_EVENT_GROUP)) + hfi_enable();You could avoid the extra level of indentation if you did: if (cpumask_weight() == 1 && has_listeners())
Ok.
You would need to also update the comment.
I'd rather remove the comment, code looks obvious enough for me. Regards Stanislaw