From: Denis Benato <denis.benato@linux.dev>
To: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>,
"Corentin Chary" <corentin.chary@gmail.com>,
"Luke Jones" <luke@ljones.dev>, busybox11 <busybox11th@gmail.com>,
"Denis Benato" <benato.denis96@gmail.com>,
"Denis Benato" <denis.benato@linux.dev>
Subject: [PATCH v3 1/4] platform/x86: asus-armoury: move has_valid_limit() above the attribute declarations
Date: Fri, 25 Sep 2026 14:42:25 +0000 [thread overview]
Message-ID: <20260925144229.3693-2-denis.benato@linux.dev> (raw)
In-Reply-To: <20260925144229.3693-1-denis.benato@linux.dev>
Pure code move in preparation for making the power tunable attribute
groups gate their visibility on the platform limits: the visibility
callbacks expanded by the group macros at the attribute declaration
sites will call has_valid_limit(), which therefore needs to be declared
before them.
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
drivers/platform/x86/asus-armoury.c | 76 ++++++++++++++---------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c
index 2d5ca75bc727..067d9db93ce4 100644
--- a/drivers/platform/x86/asus-armoury.c
+++ b/drivers/platform/x86/asus-armoury.c
@@ -782,6 +782,44 @@ static inline struct rog_tunables *get_current_tunables(void)
return asus_armoury.rog_tunables[ASUS_ROG_TUNABLE_DC];
}
+/**
+ * has_valid_limit - Checks if a power-related attribute has a valid limit value
+ * @name: The name of the attribute to check
+ * @limits: Pointer to the power_limits structure containing limit values
+ *
+ * This function checks if a power-related attribute has a valid limit value.
+ * It returns false if limits is NULL or if the corresponding limit value is zero.
+ *
+ * Return: true if the attribute has a valid limit value, false otherwise
+ */
+static bool has_valid_limit(const char *name, const struct power_limits *limits)
+{
+ u32 limit_value = 0;
+
+ if (!limits)
+ return false;
+
+ if (!strcmp(name, ATTR_PPT_PL1_SPL))
+ limit_value = limits->ppt_pl1_spl_max;
+ else if (!strcmp(name, ATTR_PPT_PL2_SPPT))
+ limit_value = limits->ppt_pl2_sppt_max;
+ else if (!strcmp(name, ATTR_PPT_PL3_FPPT))
+ limit_value = limits->ppt_pl3_fppt_max;
+ else if (!strcmp(name, ATTR_PPT_APU_SPPT))
+ limit_value = limits->ppt_apu_sppt_max;
+ else if (!strcmp(name, ATTR_PPT_PLATFORM_SPPT))
+ limit_value = limits->ppt_platform_sppt_max;
+ else if (!strcmp(name, ATTR_NV_DYNAMIC_BOOST))
+ limit_value = limits->nv_dynamic_boost_max;
+ else if (!strcmp(name, ATTR_NV_TEMP_TARGET))
+ limit_value = limits->nv_temp_target_max;
+ else if (!strcmp(name, ATTR_NV_BASE_TGP) ||
+ !strcmp(name, ATTR_NV_TGP))
+ limit_value = limits->nv_tgp_max;
+
+ return limit_value > 0;
+}
+
/* Simple attribute creation */
ASUS_ATTR_GROUP_ENUM_INT_RO(charge_mode, "charge_mode", ASUS_WMI_DEVID_CHARGE_MODE, "0;1;2\n",
"Show the current mode of charging");
@@ -871,44 +909,6 @@ static bool is_power_tunable_attr(const char *name)
return false;
}
-/**
- * has_valid_limit - Checks if a power-related attribute has a valid limit value
- * @name: The name of the attribute to check
- * @limits: Pointer to the power_limits structure containing limit values
- *
- * This function checks if a power-related attribute has a valid limit value.
- * It returns false if limits is NULL or if the corresponding limit value is zero.
- *
- * Return: true if the attribute has a valid limit value, false otherwise
- */
-static bool has_valid_limit(const char *name, const struct power_limits *limits)
-{
- u32 limit_value = 0;
-
- if (!limits)
- return false;
-
- if (!strcmp(name, ATTR_PPT_PL1_SPL))
- limit_value = limits->ppt_pl1_spl_max;
- else if (!strcmp(name, ATTR_PPT_PL2_SPPT))
- limit_value = limits->ppt_pl2_sppt_max;
- else if (!strcmp(name, ATTR_PPT_PL3_FPPT))
- limit_value = limits->ppt_pl3_fppt_max;
- else if (!strcmp(name, ATTR_PPT_APU_SPPT))
- limit_value = limits->ppt_apu_sppt_max;
- else if (!strcmp(name, ATTR_PPT_PLATFORM_SPPT))
- limit_value = limits->ppt_platform_sppt_max;
- else if (!strcmp(name, ATTR_NV_DYNAMIC_BOOST))
- limit_value = limits->nv_dynamic_boost_max;
- else if (!strcmp(name, ATTR_NV_TEMP_TARGET))
- limit_value = limits->nv_temp_target_max;
- else if (!strcmp(name, ATTR_NV_BASE_TGP) ||
- !strcmp(name, ATTR_NV_TGP))
- limit_value = limits->nv_tgp_max;
-
- return limit_value > 0;
-}
-
static int asus_fw_attr_add(void)
{
const struct rog_tunables *const ac_rog_tunables =
--
2.47.3
next prev parent reply other threads:[~2026-09-25 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 14:42 [PATCH v3 0/4] platform/x86: asus-armoury: reorganize visibility and extend dgpu_disable Denis Benato
2026-09-25 14:42 ` Denis Benato [this message]
2026-09-25 14:42 ` [PATCH v3 2/4] platform/x86: asus-armoury: let attribute groups decide their own visibility Denis Benato
2026-09-25 14:42 ` [PATCH v3 3/4] platform/x86: asus-armoury: add dGPU disable fallback DEVID for ProArt H7606 series Denis Benato
2026-09-25 14:42 ` [PATCH v3 4/4] platform/x86: asus-armoury: use sysfs_create_groups() and sysfs_remove_groups() Denis Benato
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=20260925144229.3693-2-denis.benato@linux.dev \
--to=denis.benato@linux.dev \
--cc=benato.denis96@gmail.com \
--cc=busybox11th@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
/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®