Commit e62fb1e3 authored by Mark Pearson's avatar Mark Pearson Committed by Hans de Goede
Browse files

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: default avatarMark Pearson <markpearson@lenovo.com>
Co-developed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210717143607.3580-1-hdegoede@redhat.com
parent 7f5231b1
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -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: