Re: [External]Re: [PATCH 1/3] platform/x86: think-lmi: Move pending_reboot_attr to the attributes sysfs dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-07-17 11:27 a.m., Hans de Goede wrote:
Hi,

On 7/17/21 4:36 PM, Hans de Goede wrote:
From: Mark Pearson <markpearson@xxxxxxxxxx>

Move the pending_reboot node under attributes dir where it should live, as
documented in: Documentation/ABI/testing/sysfs-class-firmware-attributes.

Also move the create / remove code to be together with the other code
populating / cleaning the attributes sysfs dir. In the removal path this
is necessary so that the remove is done before the
kset_unregister(tlmi_priv.attribute_kset) call.

Signed-off-by: Mark Pearson <markpearson@xxxxxxxxxx>
Co-developed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>

I've added this series to my review-hans and the pdx86/fixes
branches now.

Thanks Hans - they all look good to me.
I'll do some testing on a couple of my systems to confirm no issues

Mark
Regards,

Hans


---
  drivers/platform/x86/think-lmi.c | 11 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 64dcec53a7a0..989a8221dcd8 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -672,6 +672,7 @@ static void tlmi_release_attr(void)
  			kobject_put(&tlmi_priv.setting[i]->kobj);
  		}
  	}
+	sysfs_remove_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr);
  	kset_unregister(tlmi_priv.attribute_kset);
/* Authentication structures */
@@ -680,7 +681,6 @@ static void tlmi_release_attr(void)
  	sysfs_remove_group(&tlmi_priv.pwd_power->kobj, &auth_attr_group);
  	kobject_put(&tlmi_priv.pwd_power->kobj);
  	kset_unregister(tlmi_priv.authentication_kset);
-	sysfs_remove_file(&tlmi_priv.class_dev->kobj, &pending_reboot.attr);
  }
static int tlmi_sysfs_init(void)
@@ -733,6 +733,10 @@ static int tlmi_sysfs_init(void)
  			goto fail_create_attr;
  	}
+ ret = sysfs_create_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr);
+	if (ret)
+		goto fail_create_attr;
+
  	/* Create authentication entries */
  	tlmi_priv.authentication_kset = kset_create_and_add("authentication", NULL,
  								&tlmi_priv.class_dev->kobj);
@@ -760,11 +764,6 @@ static int tlmi_sysfs_init(void)
  	if (ret)
  		goto fail_create_attr;
- /* Create global sysfs files */
-	ret = sysfs_create_file(&tlmi_priv.class_dev->kobj, &pending_reboot.attr);
-	if (ret)
-		goto fail_create_attr;
-
  	return ret;
fail_create_attr:





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux