* [PATCH 1/2] platform/asus: asus-armoury: Initialize retval in armoury_has_devstate()
@ 2026-12-05 21:06 Gustaf Bergqvist
2026-12-05 21:06 ` [PATCH 2/2] platform/asus: asus-armoury: Don't warn about power limits without tunables Gustaf Bergqvist
0 siblings, 1 reply; 2+ messages in thread
From: Gustaf Bergqvist @ 2026-12-05 21:06 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Corentin Chary, Luke D. Jones,
Denis Benato
Cc: Armandas Kvietkus, Gustaf Bergqvist, platform-driver-x86, linux-kernel
armoury_has_devstate() prints retval with pr_debug() right after calling
asus_wmi_evaluate_method(). When the ACPI evaluation fails,
asus_wmi_evaluate_method3() returns -EIO without writing *retval, so the
debug message prints uninitialized stack data.
The return value is not affected, since status is checked before retval
is used. Only the debug output is wrong.
Initialize retval to 0.
This issue was found and the fix written with the help of an AI coding
assistant (Claude Code), during review of the following patch.
Fixes: f99eb098090e ("platform/x86: asus-armoury: move existing tunings to asus-armoury module")
Signed-off-by: Gustaf Bergqvist <gurra.bergqvist@gmail.com>
---
drivers/platform/asus/asus-armoury.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/asus/asus-armoury.c b/drivers/platform/asus/asus-armoury.c
index a9926c94eea4..721121982cc5 100644
--- a/drivers/platform/asus/asus-armoury.c
+++ b/drivers/platform/asus/asus-armoury.c
@@ -139,7 +139,7 @@ static bool asus_bios_requires_reboot(struct kobj_attribute *attr)
*/
static bool armoury_has_devstate(u32 dev_id)
{
- u32 retval;
+ u32 retval = 0;
int status;
status = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, dev_id, 0, &retval);
--
2.56.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] platform/asus: asus-armoury: Don't warn about power limits without tunables
2026-12-05 21:06 [PATCH 1/2] platform/asus: asus-armoury: Initialize retval in armoury_has_devstate() Gustaf Bergqvist
@ 2026-12-05 21:06 ` Gustaf Bergqvist
0 siblings, 0 replies; 2+ messages in thread
From: Gustaf Bergqvist @ 2026-12-05 21:06 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Corentin Chary, Luke D. Jones,
Denis Benato
Cc: Armandas Kvietkus, Gustaf Bergqvist, platform-driver-x86, linux-kernel
init_rog_tunables() prints "No matching power limits found for this
system" whenever the machine has no entry in the power_limits DMI table.
The warning exists to point owners of ROG/TUF models at the missing table
entry, which is why the ppt_* and nv_* attributes lack min/max limits.
The driver also loads on ASUS laptops whose firmware supports none of
these tunables, such as the Vivobook S 14 M5406WA. On those machines a
table entry would change nothing, because every attribute gated by
__ASUS_POWER_TUNABLE_GROUP_VISIBLE() also requires the firmware to report
the WMI device ID as present. The warning is still printed on every boot.
Users take it as a fault and file reports asking for their model to be
added.
Before warning, query the firmware for the device IDs behind those
attributes. Keep the warning if any of them is present, since that is the
case where a table entry helps. Otherwise log only at debug level.
Systems with a table entry, and systems whose firmware exposes at least
one tunable, behave exactly as before. The extra cost is at most nine
DSTS WMI calls at probe time, and only on systems without a table entry.
An earlier attempt to lower the warning to pr_debug()/pr_info() for all
systems was objected to because the warning helps users with missing
sliders [1]. This change keeps it for exactly those users.
[1] https://lore.kernel.org/platform-driver-x86/20260503175734.27795-1-armundunelis@gmail.com/T/
Tested on an ASUS Vivobook S 14 M5406WA (BIOS M5406WA.316) by booting
this tree. The firmware returns ASUS_WMI_UNSUPPORTED_METHOD for all nine
device IDs. The warning is no longer printed, the debug message appears
with asus_armoury.dyndbg=+p, and the exposed attributes are unchanged
(charge_mode, pending_reboot).
This change was developed with the help of an AI coding assistant
(Claude Code). I wrote and reviewed the code myself.
Signed-off-by: Gustaf Bergqvist <gurra.bergqvist@gmail.com>
---
drivers/platform/asus/asus-armoury.c | 34 +++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/asus/asus-armoury.c b/drivers/platform/asus/asus-armoury.c
index 721121982cc5..1c38a798fd6d 100644
--- a/drivers/platform/asus/asus-armoury.c
+++ b/drivers/platform/asus/asus-armoury.c
@@ -973,6 +973,35 @@ static int asus_fw_attr_add(void)
return err;
}
+/*
+ * WMI device IDs of all attributes gated by __ASUS_POWER_TUNABLE_GROUP_VISIBLE(),
+ * i.e. those that need a power_limits table entry. Keep in sync with the
+ * attribute declarations above.
+ */
+static const u32 rog_tunable_dev_ids[] = {
+ ASUS_WMI_DEVID_PPT_PL1_SPL,
+ ASUS_WMI_DEVID_PPT_PL2_SPPT,
+ ASUS_WMI_DEVID_PPT_PL3_FPPT,
+ ASUS_WMI_DEVID_PPT_APU_SPPT,
+ ASUS_WMI_DEVID_PPT_PLAT_SPPT,
+ ASUS_WMI_DEVID_NV_DYN_BOOST,
+ ASUS_WMI_DEVID_NV_THERM_TARGET,
+ ASUS_WMI_DEVID_DGPU_BASE_TGP,
+ ASUS_WMI_DEVID_DGPU_SET_TGP,
+};
+
+static bool armoury_has_rog_tunables(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(rog_tunable_dev_ids); i++) {
+ if (armoury_has_devstate(rog_tunable_dev_ids[i]))
+ return true;
+ }
+
+ return false;
+}
+
/* Init / exit ****************************************************************/
/* Set up the min/max and defaults for ROG tunables */
@@ -987,7 +1016,10 @@ static int init_rog_tunables(void)
/* Match the system against the power_limits table */
dmi_id = dmi_first_match(power_limits);
if (!dmi_id) {
- pr_warn("No matching power limits found for this system\n");
+ if (armoury_has_rog_tunables())
+ pr_warn("No matching power limits found for this system\n");
+ else
+ pr_debug("Firmware exposes no ROG power tunables\n");
return 0;
}
--
2.56.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 21:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 21:06 [PATCH 1/2] platform/asus: asus-armoury: Initialize retval in armoury_has_devstate() Gustaf Bergqvist
2026-12-05 21:06 ` [PATCH 2/2] platform/asus: asus-armoury: Don't warn about power limits without tunables Gustaf Bergqvist
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®