From: Armin Wolf <W_Armin@gmx.de>
To: corentin.chary@gmail.com, luke@ljones.dev, mohamed.ghanmi@supcom.tn
Cc: srinivas.pandruvada@linux.intel.com, hdegoede@redhat.com,
ilpo.jarvinen@linux.intel.com, Michael@phoronix.com,
casey.g.bowman@intel.com, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] platform/x86: asus-wmi: Use platform_profile_cycle()
Date: Thu, 7 Nov 2024 01:38:11 +0100 [thread overview]
Message-ID: <20241107003811.615574-3-W_Armin@gmx.de> (raw)
In-Reply-To: <20241107003811.615574-1-W_Armin@gmx.de>
Replace throttle_thermal_policy_switch_next() with
platform_profile_cycle() to reduce code duplication and avoid a
potential race condition with the platform profile handler.
Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/platform/x86/asus-wmi.c | 24 +-----------------------
1 file changed, 1 insertion(+), 23 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index ce60835d0303..ba8b6d028f9f 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -3755,28 +3755,6 @@ static int throttle_thermal_policy_set_default(struct asus_wmi *asus)
return throttle_thermal_policy_write(asus);
}
-static int throttle_thermal_policy_switch_next(struct asus_wmi *asus)
-{
- u8 new_mode = asus->throttle_thermal_policy_mode + 1;
- int err;
-
- if (new_mode > PLATFORM_PROFILE_MAX)
- new_mode = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT;
-
- asus->throttle_thermal_policy_mode = new_mode;
- err = throttle_thermal_policy_write(asus);
- if (err)
- return err;
-
- /*
- * Ensure that platform_profile updates userspace with the change to ensure
- * that platform_profile and throttle_thermal_policy_mode are in sync.
- */
- platform_profile_notify();
-
- return 0;
-}
-
static ssize_t throttle_thermal_policy_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -4301,7 +4279,7 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
if (asus->fan_boost_mode_available)
fan_boost_mode_switch_next(asus);
if (asus->throttle_thermal_policy_dev)
- throttle_thermal_policy_switch_next(asus);
+ platform_profile_cycle();
return;
}
--
2.39.5
next prev parent reply other threads:[~2024-11-07 0:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 0:38 [PATCH v2 0/2] Fix thermal profile handling Armin Wolf
2024-11-07 0:38 ` [PATCH v2 1/2] platform/x86: asus-wmi: Fix inconsistent use of thermal policies Armin Wolf
2024-11-07 9:51 ` Hans de Goede
2024-11-07 0:38 ` Armin Wolf [this message]
2024-11-07 9:52 ` [PATCH v2 2/2] platform/x86: asus-wmi: Use platform_profile_cycle() Hans de Goede
2024-11-11 7:00 ` [PATCH v2 0/2] Fix thermal profile handling Armin Wolf
2024-11-12 17:17 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241107003811.615574-3-W_Armin@gmx.de \
--to=w_armin@gmx.de \
--cc=Michael@phoronix.com \
--cc=casey.g.bowman@intel.com \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=mohamed.ghanmi@supcom.tn \
--cc=platform-driver-x86@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®