Skip to content

Commit e62fb1e

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: think-lmi: Move pending_reboot_attr to the attributes sysfs dir
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 <[email protected]> Co-developed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7f5231b commit e62fb1e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/platform/x86/think-lmi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ static void tlmi_release_attr(void)
672672
kobject_put(&tlmi_priv.setting[i]->kobj);
673673
}
674674
}
675+
sysfs_remove_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr);
675676
kset_unregister(tlmi_priv.attribute_kset);
676677

677678
/* Authentication structures */
@@ -680,7 +681,6 @@ static void tlmi_release_attr(void)
680681
sysfs_remove_group(&tlmi_priv.pwd_power->kobj, &auth_attr_group);
681682
kobject_put(&tlmi_priv.pwd_power->kobj);
682683
kset_unregister(tlmi_priv.authentication_kset);
683-
sysfs_remove_file(&tlmi_priv.class_dev->kobj, &pending_reboot.attr);
684684
}
685685

686686
static int tlmi_sysfs_init(void)
@@ -733,6 +733,10 @@ static int tlmi_sysfs_init(void)
733733
goto fail_create_attr;
734734
}
735735

736+
ret = sysfs_create_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr);
737+
if (ret)
738+
goto fail_create_attr;
739+
736740
/* Create authentication entries */
737741
tlmi_priv.authentication_kset = kset_create_and_add("authentication", NULL,
738742
&tlmi_priv.class_dev->kobj);
@@ -760,11 +764,6 @@ static int tlmi_sysfs_init(void)
760764
if (ret)
761765
goto fail_create_attr;
762766

763-
/* Create global sysfs files */
764-
ret = sysfs_create_file(&tlmi_priv.class_dev->kobj, &pending_reboot.attr);
765-
if (ret)
766-
goto fail_create_attr;
767-
768767
return ret;
769768

770769
fail_create_attr:

0 commit comments

Comments
 (0)