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: <20241205004609.2186681-2-kuurtb@gmail.com>
Date: Wed,  4 Dec 2024 21:46:10 -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 17/21] alienware-wmi: Drop thermal methods dependency on quirks

Make the `gmode` condition on AWCC WMI devices part of the device's
state container, and refactor "platform_profile" methods accordingly.

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

diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
index fa21a50d66bd..7137995d5983 100644
--- a/drivers/platform/x86/dell/alienware-wmi.c
+++ b/drivers/platform/x86/dell/alienware-wmi.c
@@ -407,6 +407,7 @@ struct awcc_priv {
 	struct wmi_device *wdev;
 	struct platform_profile_handler pp_handler;
 	enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST];
+	bool has_gmode;
 };
 
 struct alienfx_priv {
@@ -1044,7 +1045,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
 
 	priv = container_of(pprof, struct awcc_priv, pp_handler);
 
-	if (quirks->gmode) {
+	if (priv->has_gmode) {
 		u32 gmode_status;
 		int ret;
 
@@ -1070,7 +1071,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
 				    priv->supported_thermal_profiles[profile]);
 }
 
-static int create_thermal_profile(struct wmi_device *wdev)
+static int create_thermal_profile(struct wmi_device *wdev, bool has_gmode)
 {
 	struct awcc_priv *priv;
 	u32 out_data;
@@ -1115,7 +1116,8 @@ static int create_thermal_profile(struct wmi_device *wdev)
 	if (bitmap_empty(priv->pp_handler.choices, PLATFORM_PROFILE_LAST))
 		return -ENODEV;
 
-	if (quirks->gmode) {
+	if (has_gmode) {
+		priv->has_gmode = true;
 		priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] =
 			WMAX_THERMAL_MODE_GMODE;
 
@@ -1130,8 +1132,7 @@ static int create_thermal_profile(struct wmi_device *wdev)
 
 static void remove_thermal_profile(void)
 {
-	if (quirks->thermal)
-		platform_profile_remove();
+	platform_profile_remove();
 }
 
 /*
@@ -1339,7 +1340,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)
 	};
 
 	if (quirks->thermal)
-		ret = create_thermal_profile(wdev);
+		ret = create_thermal_profile(wdev, quirks->gmode);
 	else if (quirks->num_zones > 0)
 		ret = alienfx_wmi_init(&pdata);
 
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ