diff mbox series

[2/3] thermal: netlink: Export thermal_group_has_listeners()

Message ID 20240131120535.933424-3-stanislaw.gruszka@linux.intel.com
State New
Headers show
Series thermal/netlink/intel_hfi: Enable HFI feature only when required | expand

Commit Message

Stanislaw Gruszka Jan. 31, 2024, 12:05 p.m. UTC
Let drivers use thermal_group_has_listners(). The intel_hfi driver needs
it to enable HFI only when user-space consumers are present.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
---
 drivers/thermal/thermal_netlink.c |  7 +------
 drivers/thermal/thermal_netlink.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c
index 569e4fa62f73..44e8df2751ba 100644
--- a/drivers/thermal/thermal_netlink.c
+++ b/drivers/thermal/thermal_netlink.c
@@ -13,11 +13,6 @@ 
 
 #include "thermal_core.h"
 
-enum thermal_genl_multicast_groups {
-	THERMAL_GENL_SAMPLING_GROUP = 0,
-	THERMAL_GENL_EVENT_GROUP = 1,
-};
-
 static const struct genl_multicast_group thermal_genl_mcgrps[] = {
 	[THERMAL_GENL_SAMPLING_GROUP] = { .name = THERMAL_GENL_SAMPLING_GROUP_NAME, },
 	[THERMAL_GENL_EVENT_GROUP]  = { .name = THERMAL_GENL_EVENT_GROUP_NAME,  },
@@ -76,7 +71,7 @@  typedef int (*cb_t)(struct param *);
 
 static struct genl_family thermal_gnl_family;
 
-static int thermal_group_has_listeners(enum thermal_genl_multicast_groups group)
+int thermal_group_has_listeners(enum thermal_genl_multicast_groups group)
 {
 	return genl_has_listeners(&thermal_gnl_family, &init_net, group);
 }
diff --git a/drivers/thermal/thermal_netlink.h b/drivers/thermal/thermal_netlink.h
index 0a9987c3bc57..3272a966f404 100644
--- a/drivers/thermal/thermal_netlink.h
+++ b/drivers/thermal/thermal_netlink.h
@@ -10,10 +10,16 @@  struct thermal_genl_cpu_caps {
 	int efficiency;
 };
 
+enum thermal_genl_multicast_groups {
+	THERMAL_GENL_SAMPLING_GROUP = 0,
+	THERMAL_GENL_EVENT_GROUP = 1,
+};
+
 /* Netlink notification function */
 #ifdef CONFIG_THERMAL_NETLINK
 int __init thermal_netlink_init(void);
 void __init thermal_netlink_exit(void);
+int thermal_group_has_listeners(enum thermal_genl_multicast_groups group);
 int thermal_notify_tz_create(int tz_id, const char *name);
 int thermal_notify_tz_delete(int tz_id);
 int thermal_notify_tz_enable(int tz_id);
@@ -38,6 +44,11 @@  static inline int thermal_netlink_init(void)
 	return 0;
 }
 
+static inline int thermal_group_has_listeners(enum thermal_genl_multicast_groups group)
+{
+	return 0;
+}
+
 static inline int thermal_notify_tz_create(int tz_id, const char *name)
 {
 	return 0;