Skip to content

Commit 583329d

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: think-lmi: add missing type attribute
This driver was missing the mandatory type attribute...oops. Add it in along with logic to determine whether the attribute is an enumeration type or a string by parsing the possible_values attribute. Upstream bug https://bugzilla.kernel.org/show_bug.cgi?id=216460 Fixes: a40cd7e ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Signed-off-by: Mark Pearson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Thomas Weißschuh <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent b7c994f commit 583329d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/platform/x86/think-lmi.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,20 @@ static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute
947947
return sysfs_emit(buf, "%s\n", setting->possible_values);
948948
}
949949

950+
static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
951+
char *buf)
952+
{
953+
struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
954+
955+
if (setting->possible_values) {
956+
/* Figure out what setting type is as BIOS does not return this */
957+
if (strchr(setting->possible_values, ','))
958+
return sysfs_emit(buf, "enumeration\n");
959+
}
960+
/* Anything else is going to be a string */
961+
return sysfs_emit(buf, "string\n");
962+
}
963+
950964
static ssize_t current_value_store(struct kobject *kobj,
951965
struct kobj_attribute *attr,
952966
const char *buf, size_t count)
@@ -1036,10 +1050,13 @@ static struct kobj_attribute attr_possible_values = __ATTR_RO(possible_values);
10361050

10371051
static struct kobj_attribute attr_current_val = __ATTR_RW_MODE(current_value, 0600);
10381052

1053+
static struct kobj_attribute attr_type = __ATTR_RO(type);
1054+
10391055
static struct attribute *tlmi_attrs[] = {
10401056
&attr_displ_name.attr,
10411057
&attr_current_val.attr,
10421058
&attr_possible_values.attr,
1059+
&attr_type.attr,
10431060
NULL
10441061
};
10451062

0 commit comments

Comments
 (0)