]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/x86: think-lmi: Directly use firmware_attributes_class
authorThomas Weißschuh <linux@weissschuh.net>
Fri, 3 Jan 2025 23:05:11 +0000 (00:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 14:03:10 +0000 (16:03 +0200)
[ Upstream commit 55922403807a12d4f96c67ba01a920edfb6f2633 ]

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>
Stable-dep-of: 5ff1fbb30597 ("platform/x86: think-lmi: Fix class device unregistration")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/x86/think-lmi.c

index 3a496c615ce6bda26b1c6d2624c4b8d0d6c5329e..f0efa60cf8ee2b7e7ff148b609228742b698f3a5 100644 (file)
@@ -195,7 +195,6 @@ static const char * const level_options[] = {
        [TLMI_LEVEL_MASTER] = "master",
 };
 static struct think_lmi tlmi_priv;
-static const struct class *fw_attr_class;
 static DEFINE_MUTEX(tlmi_mutex);
 
 /* ------ Utility functions ------------*/
@@ -1272,11 +1271,7 @@ static int tlmi_sysfs_init(void)
 {
        int i, ret;
 
-       ret = fw_attributes_class_get(&fw_attr_class);
-       if (ret)
-               return ret;
-
-       tlmi_priv.class_dev = device_create(fw_attr_class, NULL, MKDEV(0, 0),
+       tlmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
                        NULL, "%s", "thinklmi");
        if (IS_ERR(tlmi_priv.class_dev)) {
                ret = PTR_ERR(tlmi_priv.class_dev);
@@ -1385,9 +1380,8 @@ static int tlmi_sysfs_init(void)
 fail_create_attr:
        tlmi_release_attr();
 fail_device_created:
-       device_destroy(fw_attr_class, MKDEV(0, 0));
+       device_destroy(&firmware_attributes_class, MKDEV(0, 0));
 fail_class_created:
-       fw_attributes_class_put();
        return ret;
 }
 
@@ -1610,8 +1604,7 @@ fail_clear_attr:
 static void tlmi_remove(struct wmi_device *wdev)
 {
        tlmi_release_attr();
-       device_destroy(fw_attr_class, MKDEV(0, 0));
-       fw_attributes_class_put();
+       device_destroy(&firmware_attributes_class, MKDEV(0, 0));
 }
 
 static int tlmi_probe(struct wmi_device *wdev, const void *context)