[v4,1/4] platform/x86: think-lmi: add missing type attribute

Message ID 20230320003221.561750-1-mpearson-lenovo@squebb.ca
State New
Headers
Series [v4,1/4] platform/x86: think-lmi: add missing type attribute |

Commit Message

Mark Pearson March 20, 2023, 12:32 a.m. UTC
  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

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
Changes in v4:
 - Unchanged. Sending to linux-kernel mailing list as recommended
Changes in v3:
 - Rebased on latest pdx86, review_hans branch
Changes in v2: 
 - Simplify the code and move type determination into show function
 - Don't use Fixes with URL in commit info

 drivers/platform/x86/think-lmi.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Hans de Goede March 20, 2023, 1:56 p.m. UTC | #1
Hi Mark,

It seems that while adding linux-kernel@vger.kernel.org you have dropped
platform-driver-x86@vger.kernel.org. For future patches please Cc both.

platform-driver-x86@vger.kernel.org needs to be Cc-ed for patches
to show up in patchwork:
https://patchwork.kernel.org/project/platform-driver-x86/list/

Which I use as my primary means of tracking which patches I need
to review / merge (note no need to resend this series I have it
on my radar).

More importantly you seem to not have Cc-ed
Thomas Weißschuh on this version ?

I have added Thomas to the Cc now, so that he can respond to this
version.

Regards,

Hans





On 3/20/23 01:32, Mark Pearson wrote:
> 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
> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
> Changes in v4:
>  - Unchanged. Sending to linux-kernel mailing list as recommended
> Changes in v3:
>  - Rebased on latest pdx86, review_hans branch
> Changes in v2: 
>  - Simplify the code and move type determination into show function
>  - Don't use Fixes with URL in commit info
> 
>  drivers/platform/x86/think-lmi.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index cc66f7cbccf2..a765bf8c27d8 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -947,6 +947,20 @@ static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute
>  	return sysfs_emit(buf, "%s\n", setting->possible_values);
>  }
>  
> +static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
> +		char *buf)
> +{
> +	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
> +
> +	if (setting->possible_values) {
> +		/* Figure out what setting type is as BIOS does not return this */
> +		if (strchr(setting->possible_values, ','))
> +			return sysfs_emit(buf, "enumeration\n");
> +	}
> +	/* Anything else is going to be a string */
> +	return sysfs_emit(buf, "string\n");
> +}
> +
>  static ssize_t current_value_store(struct kobject *kobj,
>  		struct kobj_attribute *attr,
>  		const char *buf, size_t count)
> @@ -1036,10 +1050,13 @@ 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 attribute *tlmi_attrs[] = {
>  	&attr_displ_name.attr,
>  	&attr_current_val.attr,
>  	&attr_possible_values.attr,
> +	&attr_type.attr,
>  	NULL
>  };
>
  
Hans de Goede March 20, 2023, 1:57 p.m. UTC | #2
Hi,

On 3/20/23 14:56, Hans de Goede wrote:
> Hi Mark,
> 
> It seems that while adding linux-kernel@vger.kernel.org you have dropped
> platform-driver-x86@vger.kernel.org. For future patches please Cc both.
> 
> platform-driver-x86@vger.kernel.org needs to be Cc-ed for patches
> to show up in patchwork:
> https://patchwork.kernel.org/project/platform-driver-x86/list/
> 
> Which I use as my primary means of tracking which patches I need
> to review / merge (note no need to resend this series I have it
> on my radar).
> 
> More importantly you seem to not have Cc-ed
> Thomas Weißschuh on this version ?

Never mind, I just noticed that Thomas has 2 email addresses
and you did Cc their other address...

Regards,

Hans



> On 3/20/23 01:32, Mark Pearson wrote:
>> 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
>>
>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>> ---
>> Changes in v4:
>>  - Unchanged. Sending to linux-kernel mailing list as recommended
>> Changes in v3:
>>  - Rebased on latest pdx86, review_hans branch
>> Changes in v2: 
>>  - Simplify the code and move type determination into show function
>>  - Don't use Fixes with URL in commit info
>>
>>  drivers/platform/x86/think-lmi.c | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>
>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>> index cc66f7cbccf2..a765bf8c27d8 100644
>> --- a/drivers/platform/x86/think-lmi.c
>> +++ b/drivers/platform/x86/think-lmi.c
>> @@ -947,6 +947,20 @@ static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute
>>  	return sysfs_emit(buf, "%s\n", setting->possible_values);
>>  }
>>  
>> +static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
>> +		char *buf)
>> +{
>> +	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
>> +
>> +	if (setting->possible_values) {
>> +		/* Figure out what setting type is as BIOS does not return this */
>> +		if (strchr(setting->possible_values, ','))
>> +			return sysfs_emit(buf, "enumeration\n");
>> +	}
>> +	/* Anything else is going to be a string */
>> +	return sysfs_emit(buf, "string\n");
>> +}
>> +
>>  static ssize_t current_value_store(struct kobject *kobj,
>>  		struct kobj_attribute *attr,
>>  		const char *buf, size_t count)
>> @@ -1036,10 +1050,13 @@ 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 attribute *tlmi_attrs[] = {
>>  	&attr_displ_name.attr,
>>  	&attr_current_val.attr,
>>  	&attr_possible_values.attr,
>> +	&attr_type.attr,
>>  	NULL
>>  };
>>
  
Mark Pearson March 20, 2023, 1:58 p.m. UTC | #3
On Mon, Mar 20, 2023, at 9:57 AM, Hans de Goede wrote:
> Hi,
>
> On 3/20/23 14:56, Hans de Goede wrote:
>> Hi Mark,
>> 
>> It seems that while adding linux-kernel@vger.kernel.org you have dropped
>> platform-driver-x86@vger.kernel.org. For future patches please Cc both.
>> 
>> platform-driver-x86@vger.kernel.org needs to be Cc-ed for patches
>> to show up in patchwork:
>> https://patchwork.kernel.org/project/platform-driver-x86/list/
>> 
>> Which I use as my primary means of tracking which patches I need
>> to review / merge (note no need to resend this series I have it
>> on my radar).
>> 
>> More importantly you seem to not have Cc-ed
>> Thomas Weißschuh on this version ?
>
> Never mind, I just noticed that Thomas has 2 email addresses
> and you did Cc their other address...

Yep - and no idea how I missed pdx86 mailing list....must have been a copy paste error :( Sorry - not deliberate.

Mark

>
> Regards,
>
> Hans
>
>
>
>> On 3/20/23 01:32, Mark Pearson wrote:
>>> 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
>>>
>>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>>> ---
>>> Changes in v4:
>>>  - Unchanged. Sending to linux-kernel mailing list as recommended
>>> Changes in v3:
>>>  - Rebased on latest pdx86, review_hans branch
>>> Changes in v2: 
>>>  - Simplify the code and move type determination into show function
>>>  - Don't use Fixes with URL in commit info
>>>
>>>  drivers/platform/x86/think-lmi.c | 17 +++++++++++++++++
>>>  1 file changed, 17 insertions(+)
>>>
>>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>>> index cc66f7cbccf2..a765bf8c27d8 100644
>>> --- a/drivers/platform/x86/think-lmi.c
>>> +++ b/drivers/platform/x86/think-lmi.c
>>> @@ -947,6 +947,20 @@ static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute
>>>  	return sysfs_emit(buf, "%s\n", setting->possible_values);
>>>  }
>>>  
>>> +static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
>>> +		char *buf)
>>> +{
>>> +	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
>>> +
>>> +	if (setting->possible_values) {
>>> +		/* Figure out what setting type is as BIOS does not return this */
>>> +		if (strchr(setting->possible_values, ','))
>>> +			return sysfs_emit(buf, "enumeration\n");
>>> +	}
>>> +	/* Anything else is going to be a string */
>>> +	return sysfs_emit(buf, "string\n");
>>> +}
>>> +
>>>  static ssize_t current_value_store(struct kobject *kobj,
>>>  		struct kobj_attribute *attr,
>>>  		const char *buf, size_t count)
>>> @@ -1036,10 +1050,13 @@ 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 attribute *tlmi_attrs[] = {
>>>  	&attr_displ_name.attr,
>>>  	&attr_current_val.attr,
>>>  	&attr_possible_values.attr,
>>> +	&attr_type.attr,
>>>  	NULL
>>>  };
>>>
  

Patch

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index cc66f7cbccf2..a765bf8c27d8 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -947,6 +947,20 @@  static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute
 	return sysfs_emit(buf, "%s\n", setting->possible_values);
 }
 
+static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
+		char *buf)
+{
+	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
+
+	if (setting->possible_values) {
+		/* Figure out what setting type is as BIOS does not return this */
+		if (strchr(setting->possible_values, ','))
+			return sysfs_emit(buf, "enumeration\n");
+	}
+	/* Anything else is going to be a string */
+	return sysfs_emit(buf, "string\n");
+}
+
 static ssize_t current_value_store(struct kobject *kobj,
 		struct kobj_attribute *attr,
 		const char *buf, size_t count)
@@ -1036,10 +1050,13 @@  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 attribute *tlmi_attrs[] = {
 	&attr_displ_name.attr,
 	&attr_current_val.attr,
 	&attr_possible_values.attr,
+	&attr_type.attr,
 	NULL
 };