[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241120164348.7326-2-kuurtb@gmail.com>
Date: Wed, 20 Nov 2024 13:43:49 -0300
From: Kurt Borja <kuurtb@...il.com>
To: kuurtb@...il.com
Cc: Dell.Client.Kernel@...l.com,
hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
linux-kernel@...r.kernel.org,
mario.limonciello@....com,
platform-driver-x86@...r.kernel.org,
w_armin@....de
Subject: [PATCH v2 3/4] alienware-wmi: Simplify platform device creation
Simplify platform device creation by using
platform_device_register_simple().
Reviewed-by: Mario Limonciello <mario.limonciello@....com>
Signed-off-by: Kurt Borja <kuurtb@...il.com>
---
v2:
- Unchanged
---
drivers/platform/x86/dell/alienware-wmi.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
index ecab14d90b27..512f6b22585c 100644
--- a/drivers/platform/x86/dell/alienware-wmi.c
+++ b/drivers/platform/x86/dell/alienware-wmi.c
@@ -1163,14 +1163,13 @@ static int __init alienware_wmi_init(void)
ret = platform_driver_register(&platform_driver);
if (ret)
goto fail_platform_driver;
- platform_device = platform_device_alloc("alienware-wmi", PLATFORM_DEVID_NONE);
- if (!platform_device) {
- ret = -ENOMEM;
+
+ platform_device = platform_device_register_simple("alienware-wmi",
+ PLATFORM_DEVID_NONE, NULL, 0);
+ if (IS_ERR(platform_device)) {
+ ret = PTR_ERR(platform_device);
goto fail_platform_device1;
}
- ret = platform_device_add(platform_device);
- if (ret)
- goto fail_platform_device2;
if (quirks->thermal) {
ret = create_thermal_profile();
@@ -1187,9 +1186,7 @@ static int __init alienware_wmi_init(void)
fail_prep_zones:
remove_thermal_profile();
fail_prep_thermal_profile:
- platform_device_del(platform_device);
-fail_platform_device2:
- platform_device_put(platform_device);
+ platform_device_unregister(platform_device);
fail_platform_device1:
platform_driver_unregister(&platform_driver);
fail_platform_driver:
--
2.47.0
Powered by blists - more mailing lists