[PATCH 12/13] platform/x86: lenovo: tlmi: Add method identifier

From: Mark Pearson

Date: Thu Dec 03 2026 - 21:21:25 EST


Add the ability to see whether attributes are regular, platform or
function attributes.

Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
---
drivers/platform/x86/lenovo/tlmi-config.c | 26 +++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/drivers/platform/x86/lenovo/tlmi-config.c b/drivers/platform/x86/lenovo/tlmi-config.c
index 76cf86ee4907..eb7e8b54271c 100644
--- a/drivers/platform/x86/lenovo/tlmi-config.c
+++ b/drivers/platform/x86/lenovo/tlmi-config.c
@@ -146,6 +146,12 @@ static ssize_t function_type_show(struct kobject *kobj, struct kobj_attribute *a
return common_type_show(setting->possible_values, buf);
}

+static ssize_t function_method_show(struct kobject *kobj, struct kobj_attribute *f,
+ char *buf)
+{
+ return sysfs_emit(buf, "function\n");
+}
+
static ssize_t function_current_value_store(struct kobject *kobj,
struct kobj_attribute *f,
const char *buf, size_t count)
@@ -181,12 +187,15 @@ static struct kobj_attribute function_current_val = __ATTR(current_value, 0600,
function_current_value_show,
function_current_value_store);
static struct kobj_attribute function_type = __ATTR(type, 0444, function_type_show, NULL);
+static struct kobj_attribute function_method = __ATTR(method, 0444,
+ function_method_show, NULL);

static struct attribute *tlmi_function[] = {
&function_display_name.attr,
&function_current_val.attr,
&function_possible_values.attr,
&function_type.attr,
+ &function_method.attr,
NULL
};

@@ -258,6 +267,12 @@ static ssize_t platform_onreboot_show(struct kobject *kobj, struct kobj_attribut
return sysfs_emit(buf, "%d\n", setting->on_reboot);
}

+static ssize_t platform_method_show(struct kobject *kobj, struct kobj_attribute *f,
+ char *buf)
+{
+ return sysfs_emit(buf, "platform\n");
+}
+
static ssize_t platform_current_value_store(struct kobject *kobj,
struct kobj_attribute *p,
const char *buf, size_t count)
@@ -296,6 +311,8 @@ static struct kobj_attribute platform_current_val = __ATTR(current_value, 0600,
static struct kobj_attribute platform_type = __ATTR(type, 0444, platform_type_show, NULL);
static struct kobj_attribute platform_onreboot = __ATTR(onreboot, 0444, platform_onreboot_show,
NULL);
+static struct kobj_attribute platform_method = __ATTR(method, 0444,
+ platform_method_show, NULL);

static struct attribute *tlmi_platform[] = {
&platform_display_name.attr,
@@ -303,6 +320,7 @@ static struct attribute *tlmi_platform[] = {
&platform_possible_values.attr,
&platform_type.attr,
&platform_onreboot.attr,
+ &platform_method.attr,
NULL
};

@@ -364,6 +382,12 @@ static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
return common_type_show(setting->possible_values, buf);
}

+static ssize_t method_show(struct kobject *kobj, struct kobj_attribute *f,
+ char *buf)
+{
+ return sysfs_emit(buf, "setting\n");
+}
+
static ssize_t current_value_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
@@ -396,12 +420,14 @@ static struct kobj_attribute attr_possible_values = __ATTR_RO(possible_values);
static struct kobj_attribute attr_current_val = __ATTR_RW_MODE(current_value, 0600);

static struct kobj_attribute attr_type = __ATTR_RO(type);
+static struct kobj_attribute attr_method = __ATTR_RO(method);

static struct attribute *tlmi_attrs[] = {
&attr_display_name.attr,
&attr_current_val.attr,
&attr_possible_values.attr,
&attr_type.attr,
+ &attr_method.attr,
NULL
};

--
2.43.0