platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: think-lmi: Remove custom kobject sysfs_ops
@ 2023-03-14  0:07 Thomas Weißschuh
  2023-03-16 14:44 ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Weißschuh @ 2023-03-14  0:07 UTC (permalink / raw)
  To: Mark Pearson, Hans de Goede, Mark Gross
  Cc: platform-driver-x86, linux-kernel, Thomas Weißschuh

think-lmi defines its own sysfs_ops that are identical to the standard
kobj_sysfs_ops. Use the standard definitions.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---

This has only been compile-tested.
---
 drivers/platform/x86/think-lmi.c | 31 ++-----------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 86b33b74519b..2b5ae68ffce8 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -1047,33 +1047,6 @@ static const struct attribute_group tlmi_attr_group = {
 	.attrs = tlmi_attrs,
 };
 
-static ssize_t tlmi_attr_show(struct kobject *kobj, struct attribute *attr,
-				    char *buf)
-{
-	struct kobj_attribute *kattr;
-
-	kattr = container_of(attr, struct kobj_attribute, attr);
-	if (kattr->show)
-		return kattr->show(kobj, kattr, buf);
-	return -EIO;
-}
-
-static ssize_t tlmi_attr_store(struct kobject *kobj, struct attribute *attr,
-				     const char *buf, size_t count)
-{
-	struct kobj_attribute *kattr;
-
-	kattr = container_of(attr, struct kobj_attribute, attr);
-	if (kattr->store)
-		return kattr->store(kobj, kattr, buf, count);
-	return -EIO;
-}
-
-static const struct sysfs_ops tlmi_kobj_sysfs_ops = {
-	.show	= tlmi_attr_show,
-	.store	= tlmi_attr_store,
-};
-
 static void tlmi_attr_setting_release(struct kobject *kobj)
 {
 	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
@@ -1091,12 +1064,12 @@ static void tlmi_pwd_setting_release(struct kobject *kobj)
 
 static const struct kobj_type tlmi_attr_setting_ktype = {
 	.release        = &tlmi_attr_setting_release,
-	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
+	.sysfs_ops	= &kobj_sysfs_ops,
 };
 
 static const struct kobj_type tlmi_pwd_setting_ktype = {
 	.release        = &tlmi_pwd_setting_release,
-	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
+	.sysfs_ops	= &kobj_sysfs_ops,
 };
 
 static ssize_t pending_reboot_show(struct kobject *kobj, struct kobj_attribute *attr,

---
base-commit: eeac8ede17557680855031c6f305ece2378af326
change-id: 20230314-think-lmi-sysfs_ops-e849a18299bb

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: think-lmi: Remove custom kobject sysfs_ops
  2023-03-14  0:07 [PATCH] platform/x86: think-lmi: Remove custom kobject sysfs_ops Thomas Weißschuh
@ 2023-03-16 14:44 ` Hans de Goede
  2023-03-17 13:37   ` Mark Pearson
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2023-03-16 14:44 UTC (permalink / raw)
  To: Thomas Weißschuh, Mark Pearson, Mark Gross
  Cc: platform-driver-x86, linux-kernel

Hi,

On 3/14/23 01:07, Thomas Weißschuh wrote:
> think-lmi defines its own sysfs_ops that are identical to the standard
> kobj_sysfs_ops. Use the standard definitions.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
> 
> This has only been compile-tested.
> ---
>  drivers/platform/x86/think-lmi.c | 31 ++-----------------------------
>  1 file changed, 2 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 86b33b74519b..2b5ae68ffce8 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -1047,33 +1047,6 @@ static const struct attribute_group tlmi_attr_group = {
>  	.attrs = tlmi_attrs,
>  };
>  
> -static ssize_t tlmi_attr_show(struct kobject *kobj, struct attribute *attr,
> -				    char *buf)
> -{
> -	struct kobj_attribute *kattr;
> -
> -	kattr = container_of(attr, struct kobj_attribute, attr);
> -	if (kattr->show)
> -		return kattr->show(kobj, kattr, buf);
> -	return -EIO;
> -}
> -
> -static ssize_t tlmi_attr_store(struct kobject *kobj, struct attribute *attr,
> -				     const char *buf, size_t count)
> -{
> -	struct kobj_attribute *kattr;
> -
> -	kattr = container_of(attr, struct kobj_attribute, attr);
> -	if (kattr->store)
> -		return kattr->store(kobj, kattr, buf, count);
> -	return -EIO;
> -}
> -
> -static const struct sysfs_ops tlmi_kobj_sysfs_ops = {
> -	.show	= tlmi_attr_show,
> -	.store	= tlmi_attr_store,
> -};
> -
>  static void tlmi_attr_setting_release(struct kobject *kobj)
>  {
>  	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
> @@ -1091,12 +1064,12 @@ static void tlmi_pwd_setting_release(struct kobject *kobj)
>  
>  static const struct kobj_type tlmi_attr_setting_ktype = {
>  	.release        = &tlmi_attr_setting_release,
> -	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
> +	.sysfs_ops	= &kobj_sysfs_ops,
>  };
>  
>  static const struct kobj_type tlmi_pwd_setting_ktype = {
>  	.release        = &tlmi_pwd_setting_release,
> -	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
> +	.sysfs_ops	= &kobj_sysfs_ops,
>  };
>  
>  static ssize_t pending_reboot_show(struct kobject *kobj, struct kobj_attribute *attr,
> 
> ---
> base-commit: eeac8ede17557680855031c6f305ece2378af326
> change-id: 20230314-think-lmi-sysfs_ops-e849a18299bb
> 
> Best regards,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: think-lmi: Remove custom kobject sysfs_ops
  2023-03-16 14:44 ` Hans de Goede
@ 2023-03-17 13:37   ` Mark Pearson
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Pearson @ 2023-03-17 13:37 UTC (permalink / raw)
  To: Hans de Goede, Thomas Weißschuh, Mark Pearson, markgross
  Cc: platform-driver-x86, linux-kernel

Thanks Thomas,

Tested on a couple of my platforms - all looked good.

Tested-by: mpearson-lenovo@squebb.ca

Mark

On Thu, Mar 16, 2023, at 10:44 AM, Hans de Goede wrote:
> Hi,
>
> On 3/14/23 01:07, Thomas Weißschuh wrote:
>> think-lmi defines its own sysfs_ops that are identical to the standard
>> kobj_sysfs_ops. Use the standard definitions.
>> 
>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>
> Thank you for your patch, I've applied this patch to my review-hans 
> branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
>
> Note it will show up in my review-hans branch once I've pushed my
> local branch there, which might take a while.
>
> Once I've run some tests on this branch the patches there will be
> added to the platform-drivers-x86/for-next branch and eventually
> will be included in the pdx86 pull-request to Linus for the next
> merge-window.
>
> Regards,
>
> Hans
>
>
>> ---
>> 
>> This has only been compile-tested.
>> ---
>>  drivers/platform/x86/think-lmi.c | 31 ++-----------------------------
>>  1 file changed, 2 insertions(+), 29 deletions(-)
>> 
>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>> index 86b33b74519b..2b5ae68ffce8 100644
>> --- a/drivers/platform/x86/think-lmi.c
>> +++ b/drivers/platform/x86/think-lmi.c
>> @@ -1047,33 +1047,6 @@ static const struct attribute_group tlmi_attr_group = {
>>  	.attrs = tlmi_attrs,
>>  };
>>  
>> -static ssize_t tlmi_attr_show(struct kobject *kobj, struct attribute *attr,
>> -				    char *buf)
>> -{
>> -	struct kobj_attribute *kattr;
>> -
>> -	kattr = container_of(attr, struct kobj_attribute, attr);
>> -	if (kattr->show)
>> -		return kattr->show(kobj, kattr, buf);
>> -	return -EIO;
>> -}
>> -
>> -static ssize_t tlmi_attr_store(struct kobject *kobj, struct attribute *attr,
>> -				     const char *buf, size_t count)
>> -{
>> -	struct kobj_attribute *kattr;
>> -
>> -	kattr = container_of(attr, struct kobj_attribute, attr);
>> -	if (kattr->store)
>> -		return kattr->store(kobj, kattr, buf, count);
>> -	return -EIO;
>> -}
>> -
>> -static const struct sysfs_ops tlmi_kobj_sysfs_ops = {
>> -	.show	= tlmi_attr_show,
>> -	.store	= tlmi_attr_store,
>> -};
>> -
>>  static void tlmi_attr_setting_release(struct kobject *kobj)
>>  {
>>  	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
>> @@ -1091,12 +1064,12 @@ static void tlmi_pwd_setting_release(struct kobject *kobj)
>>  
>>  static const struct kobj_type tlmi_attr_setting_ktype = {
>>  	.release        = &tlmi_attr_setting_release,
>> -	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
>> +	.sysfs_ops	= &kobj_sysfs_ops,
>>  };
>>  
>>  static const struct kobj_type tlmi_pwd_setting_ktype = {
>>  	.release        = &tlmi_pwd_setting_release,
>> -	.sysfs_ops	= &tlmi_kobj_sysfs_ops,
>> +	.sysfs_ops	= &kobj_sysfs_ops,
>>  };
>>  
>>  static ssize_t pending_reboot_show(struct kobject *kobj, struct kobj_attribute *attr,
>> 
>> ---
>> base-commit: eeac8ede17557680855031c6f305ece2378af326
>> change-id: 20230314-think-lmi-sysfs_ops-e849a18299bb
>> 
>> Best regards,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-17 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  0:07 [PATCH] platform/x86: think-lmi: Remove custom kobject sysfs_ops Thomas Weißschuh
2023-03-16 14:44 ` Hans de Goede
2023-03-17 13:37   ` Mark Pearson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).