platform/x86: think-lmi: Directly use firmware_attributes_class

The usage of the lifecycle functions is not necessary anymore.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250104-firmware-attributes-simplify-v1-3-949f9709e405@weissschuh.net
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
Thomas Weißschuh 2025-01-04 00:05:11 +01:00 committed by Ilpo Järvinen
parent d03cfde56f
commit 5592240380
No known key found for this signature in database
GPG key ID: 59AC4F6153E5CE31

View file

@ -194,7 +194,6 @@ static const char * const level_options[] = {
[TLMI_LEVEL_MASTER] = "master", [TLMI_LEVEL_MASTER] = "master",
}; };
static struct think_lmi tlmi_priv; static struct think_lmi tlmi_priv;
static const struct class *fw_attr_class;
static DEFINE_MUTEX(tlmi_mutex); static DEFINE_MUTEX(tlmi_mutex);
static inline struct tlmi_pwd_setting *to_tlmi_pwd_setting(struct kobject *kobj) static inline struct tlmi_pwd_setting *to_tlmi_pwd_setting(struct kobject *kobj)
@ -1446,11 +1445,7 @@ static int tlmi_sysfs_init(void)
{ {
int i, ret; int i, ret;
ret = fw_attributes_class_get(&fw_attr_class); tlmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
if (ret)
return ret;
tlmi_priv.class_dev = device_create(fw_attr_class, NULL, MKDEV(0, 0),
NULL, "%s", "thinklmi"); NULL, "%s", "thinklmi");
if (IS_ERR(tlmi_priv.class_dev)) { if (IS_ERR(tlmi_priv.class_dev)) {
ret = PTR_ERR(tlmi_priv.class_dev); ret = PTR_ERR(tlmi_priv.class_dev);
@ -1563,9 +1558,8 @@ static int tlmi_sysfs_init(void)
fail_create_attr: fail_create_attr:
tlmi_release_attr(); tlmi_release_attr();
fail_device_created: fail_device_created:
device_destroy(fw_attr_class, MKDEV(0, 0)); device_destroy(&firmware_attributes_class, MKDEV(0, 0));
fail_class_created: fail_class_created:
fw_attributes_class_put();
return ret; return ret;
} }
@ -1788,8 +1782,7 @@ fail_clear_attr:
static void tlmi_remove(struct wmi_device *wdev) static void tlmi_remove(struct wmi_device *wdev)
{ {
tlmi_release_attr(); tlmi_release_attr();
device_destroy(fw_attr_class, MKDEV(0, 0)); device_destroy(&firmware_attributes_class, MKDEV(0, 0));
fw_attributes_class_put();
} }
static int tlmi_probe(struct wmi_device *wdev, const void *context) static int tlmi_probe(struct wmi_device *wdev, const void *context)