[PATCH v4 6/6] thermal/drivers/intel_menlow: Make additionnal sysfs information optional

From: Daniel Lezcano
Date: Wed Apr 19 2023 - 04:34:30 EST


The Menlon thermal driver creates auxiliary trip points in the thermal
zone sysfs directory. It is specific to Menlon. Actually these trip
points could be generalized with the generic trip points in the future.

Let's make the code optional and disable it by default so we have a
consistency with the attributes in the thermal zone sysfs
directories. If that hurts we will enable by default this option
instead of disabling it.

Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
---
drivers/thermal/intel/Kconfig | 11 +++++++++++
drivers/thermal/intel/intel_menlow.c | 9 +++++++++
2 files changed, 20 insertions(+)

diff --git a/drivers/thermal/intel/Kconfig b/drivers/thermal/intel/Kconfig
index cb7e7697cf1e..ef7ffe6b56a0 100644
--- a/drivers/thermal/intel/Kconfig
+++ b/drivers/thermal/intel/Kconfig
@@ -112,6 +112,17 @@ config INTEL_MENLOW

If unsure, say N.

+config INTEL_MENLOW_SYSFS_ADDON
+ bool "Enable extra sysfs attributes in the thermal zone"
+ depends on INTEL_MENLOW
+ def_bool n
+ help
+ Create auxiliary trip points in the thermal zone sysfs
+ directory. This is specific to this driver. By default those
+ are disabled and are candidate for removal, if you need these
+ information anyway, enable the option or upgrade the
+ userspace program using them.
+
config INTEL_HFI_THERMAL
bool "Intel Hardware Feedback Interface"
depends on NET
diff --git a/drivers/thermal/intel/intel_menlow.c b/drivers/thermal/intel/intel_menlow.c
index d720add918ff..605983be516c 100644
--- a/drivers/thermal/intel/intel_menlow.c
+++ b/drivers/thermal/intel/intel_menlow.c
@@ -367,6 +367,7 @@ static ssize_t bios_enabled_show(struct device *dev,
return sprintf(buf, "%s\n", bios_enabled ? "enabled" : "disabled");
}

+#ifdef CONFIG_INTEL_MENLOW_SYSFS_ADDON
static int intel_menlow_add_one_attribute(char *name, umode_t mode, void *show,
void *store, struct device *dev,
acpi_handle handle)
@@ -398,6 +399,14 @@ static int intel_menlow_add_one_attribute(char *name, umode_t mode, void *show,

return 0;
}
+#else
+static int intel_menlow_add_one_attribute(char *name, umode_t mode, void *show,
+ void *store, struct device *dev,
+ acpi_handle handle)
+{
+ return 0;
+}
+#endif

static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
void *context, void **rv)
--
2.34.1