lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241205004150.2185529-2-kuurtb@gmail.com>
Date: Wed,  4 Dec 2024 21:41:51 -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: [RFC PATCH 09/21] alienware-wmi: Initialize WMI drivers

Usually, laptop models only support one of the two WMI devices, however,
to avoid the risk of registering two platform devices with the same
name, the WMAX device driver is always preferred.

Signed-off-by: Kurt Borja <kuurtb@...il.com>
---
 drivers/platform/x86/dell/alienware-wmi.c | 48 ++++-------------------
 1 file changed, 8 insertions(+), 40 deletions(-)

diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
index 38e9cb80ae69..34fb59a14bc0 100644
--- a/drivers/platform/x86/dell/alienware-wmi.c
+++ b/drivers/platform/x86/dell/alienware-wmi.c
@@ -415,11 +415,11 @@ struct alienfx_platdata {
 	struct wmi_device *wdev;
 };
 
-static struct platform_device *platform_device;
 static struct platform_profile_handler pp_handler;
 static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST];
 
 static u8 interface;
+static struct wmi_driver *preferred_wmi_driver;
 
 /*
  * Helpers used for zone control
@@ -1263,15 +1263,12 @@ static struct wmi_driver alienware_wmax_wmi_driver = {
 
 static int __init alienware_wmi_init(void)
 {
-	int ret;
-
-	if (wmi_has_guid(LEGACY_CONTROL_GUID))
-		interface = LEGACY;
-	else if (wmi_has_guid(WMAX_CONTROL_GUID))
+	if (wmi_has_guid(WMAX_CONTROL_GUID)) {
 		interface = WMAX;
-	else {
-		pr_warn("alienware-wmi: No known WMI GUID found\n");
-		return -ENODEV;
+		preferred_wmi_driver = &alienware_wmax_wmi_driver;
+	} else {
+		interface = LEGACY;
+		preferred_wmi_driver = &alienware_legacy_wmi_driver;
 	}
 
 	dmi_check_system(alienware_quirks);
@@ -1288,43 +1285,14 @@ static int __init alienware_wmi_init(void)
 			pr_warn("force_gmode requires platform profile support\n");
 	}
 
-	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;
-		goto fail_platform_device1;
-	}
-	ret = platform_device_add(platform_device);
-	if (ret)
-		goto fail_platform_device2;
-
-	if (quirks->thermal) {
-		ret = create_thermal_profile();
-		if (ret)
-			goto fail_prep_thermal_profile;
-	}
-
-	return 0;
-
-fail_prep_thermal_profile:
-	platform_device_del(platform_device);
-fail_platform_device2:
-	platform_device_put(platform_device);
-fail_platform_device1:
-	platform_driver_unregister(&platform_driver);
-fail_platform_driver:
-	return ret;
+	return wmi_driver_register(preferred_wmi_driver);
 }
 
 module_init(alienware_wmi_init);
 
 static void __exit alienware_wmi_exit(void)
 {
-	remove_thermal_profile();
-	platform_device_unregister(platform_device);
-	platform_driver_unregister(&platform_driver);
+	wmi_driver_unregister(preferred_wmi_driver);
 }
 
 module_exit(alienware_wmi_exit);
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ