mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ahmed Yaseen <yaseen@ghoul.dev>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Corentin Chary" <corentin.chary@gmail.com>,
	"Luke D. Jones" <luke@ljones.dev>,
	"Denis Benato" <denis.benato@linux.dev>
Cc: Mario Limonciello <mario.limonciello@amd.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ahmed Yaseen <yaseen@ghoul.dev>
Subject: [PATCH 1/2] platform/x86: asus-armoury: fix sysfs_notify() of grouped attributes
Date: Fri, 28 Aug 2026 11:12:49 +0000	[thread overview]
Message-ID: <20260828111232.74443-2-yaseen@ghoul.dev> (raw)
In-Reply-To: <20260828111232.74443-1-yaseen@ghoul.dev>

The store handlers call sysfs_notify(kobj, NULL, attr->attr.name), but
kobj is the "attributes" directory and the name is always
"current_value". Named groups get no kobject of their own, so the
lookup finds nothing and the notify quietly does nothing: a poll() on
<attribute>/current_value never wakes up.

Pass the group name down so the notify resolves
attributes/<group>/current_value. armoury_attr_uint_store() takes a new
fsname argument, threaded through __WMI_STORE_INT() and
__ROG_TUNABLE_RW(); the hand-written stores pass their own group names.

Fixes: f99eb098090e ("platform/x86: asus-armoury: move existing tunings to asus-armoury module")
Signed-off-by: Ahmed Yaseen <yaseen@ghoul.dev>
---
 drivers/platform/x86/asus-armoury.c | 15 ++++++++-------
 drivers/platform/x86/asus-armoury.h | 16 +++++++++-------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c
index 93d9665717af..8e85fb08bd59 100644
--- a/drivers/platform/x86/asus-armoury.c
+++ b/drivers/platform/x86/asus-armoury.c
@@ -295,7 +295,7 @@ static int armoury_attr_enum_list(char *buf, size_t enum_values)
 
 ssize_t armoury_attr_uint_store(struct kobject *kobj, struct kobj_attribute *attr,
 				const char *buf, size_t count, u32 min, u32 max,
-				u32 *store_value, u32 wmi_dev)
+				u32 *store_value, u32 wmi_dev, const char *fsname)
 {
 	u32 value;
 	int err;
@@ -313,7 +313,7 @@ ssize_t armoury_attr_uint_store(struct kobject *kobj, struct kobj_attribute *att
 
 	if (store_value != NULL)
 		*store_value = value;
-	sysfs_notify(kobj, NULL, attr->attr.name);
+	sysfs_notify(kobj, fsname, attr->attr.name);
 
 	if (asus_bios_requires_reboot(attr))
 		asus_set_reboot_and_signal_event();
@@ -443,7 +443,8 @@ static ssize_t mini_led_mode_current_value_store(struct kobject *kobj,
 
 	return armoury_attr_uint_store(kobj, attr, mapped_value, count, 0,
 				       mini_led_mode_map[mode], NULL,
-				       asus_armoury.mini_led_dev_id);
+				       asus_armoury.mini_led_dev_id,
+				       "mini_led_mode");
 }
 
 static ssize_t mini_led_mode_possible_values_show(struct kobject *kobj,
@@ -496,7 +497,7 @@ static ssize_t gpu_mux_mode_current_value_store(struct kobject *kobj,
 	if (err)
 		return err;
 
-	sysfs_notify(kobj, NULL, attr->attr.name);
+	sysfs_notify(kobj, "gpu_mux_mode", attr->attr.name);
 	asus_set_reboot_and_signal_event();
 
 	return count;
@@ -531,7 +532,7 @@ static ssize_t dgpu_disable_current_value_store(struct kobject *kobj,
 			return err;
 	}
 
-	sysfs_notify(kobj, NULL, attr->attr.name);
+	sysfs_notify(kobj, "dgpu_disable", attr->attr.name);
 
 	return count;
 }
@@ -653,7 +654,7 @@ static ssize_t egpu_enable_current_value_store(struct kobject *kobj, struct kobj
 	 */
 	armoury_pci_rescan();
 
-	sysfs_notify(kobj, NULL, attr->attr.name);
+	sysfs_notify(kobj, "egpu_enable", attr->attr.name);
 
 	return count;
 }
@@ -747,7 +748,7 @@ static ssize_t apu_mem_current_value_store(struct kobject *kobj, struct kobj_att
 	}
 
 	pr_info("APU memory changed to %uGB, reboot required\n", requested + 1);
-	sysfs_notify(kobj, NULL, attr->attr.name);
+	sysfs_notify(kobj, "apu_mem", attr->attr.name);
 
 	asus_set_reboot_and_signal_event();
 
diff --git a/drivers/platform/x86/asus-armoury.h b/drivers/platform/x86/asus-armoury.h
index afcb517dc5bf..f55dc2a5ccc0 100644
--- a/drivers/platform/x86/asus-armoury.h
+++ b/drivers/platform/x86/asus-armoury.h
@@ -25,6 +25,7 @@
  * @max: Maximum accepted value. Above this returns -EINVAL.
  * @store_value: Pointer to where the parsed value should be stored.
  * @wmi_dev: The WMI function ID to use.
+ * @fsname: The name of the attribute's group directory, for sysfs_notify().
  *
  * This function is intended to be generic so it can be called from any "_store"
  * attribute which works only with integers.
@@ -40,7 +41,7 @@
  */
 ssize_t armoury_attr_uint_store(struct kobject *kobj, struct kobj_attribute *attr,
 				const char *buf, size_t count, u32 min, u32 max,
-				u32 *store_value, u32 wmi_dev);
+				u32 *store_value, u32 wmi_dev, const char *fsname);
 
 /**
  * armoury_attr_uint_show() - Receive an uint from a WMI method.
@@ -72,13 +73,13 @@ ssize_t armoury_attr_uint_show(struct kobject *kobj, struct kobj_attribute *attr
 #define __ASUS_ATTR_RW(_func, _name) \
 	__ATTR(_name, 0644, _func##_##_name##_show, _func##_##_name##_store)
 
-#define __WMI_STORE_INT(_attr, _min, _max, _wmi)				\
+#define __WMI_STORE_INT(_attr, _min, _max, _wmi, _fsname)			\
 	static ssize_t _attr##_store(struct kobject *kobj,			\
 				     struct kobj_attribute *attr,		\
 				     const char *buf, size_t count)		\
 	{									\
 		return armoury_attr_uint_store(kobj, attr, buf, count, _min,	\
-					_max, NULL, _wmi);			\
+					_max, NULL, _wmi, _fsname);		\
 	}
 
 #define ASUS_WMI_SHOW_INT(_attr, _wmi)						\
@@ -121,7 +122,8 @@ ssize_t armoury_attr_uint_show(struct kobject *kobj, struct kobj_attribute *attr
 
 #define __ATTR_RW_INT_GROUP_ENUM(_attrname, _minv, _maxv, _wmi, _fsname,\
 				 _possible, _dispname)			\
-	__WMI_STORE_INT(_attrname##_current_value, _minv, _maxv, _wmi);	\
+	__WMI_STORE_INT(_attrname##_current_value, _minv, _maxv, _wmi,	\
+			_fsname);					\
 	ASUS_WMI_SHOW_INT(_attrname##_current_value, _wmi);	\
 	static struct kobj_attribute attr_##_attrname##_current_value =	\
 		__ASUS_ATTR_RW(_attrname, current_value);		\
@@ -251,7 +253,7 @@ ssize_t armoury_attr_uint_show(struct kobject *kobj, struct kobj_attribute *attr
 	static struct kobj_attribute attr_##_attrname##_default_value =		\
 		__ASUS_ATTR_RO(_attrname, default_value)
 
-#define __ROG_TUNABLE_RW(_attr, _wmi)						\
+#define __ROG_TUNABLE_RW(_attr, _wmi, _fsname)					\
 	static ssize_t _attr##_current_value_store(				\
 		struct kobject *kobj, struct kobj_attribute *attr,		\
 		const char *buf, size_t count)					\
@@ -268,7 +270,7 @@ ssize_t armoury_attr_uint_show(struct kobject *kobj, struct kobj_attribute *attr
 		return armoury_attr_uint_store(kobj, attr, buf, count,		\
 				       tunables->power_limits->_attr##_min,	\
 				       tunables->power_limits->_attr##_max,	\
-				       &tunables->_attr, _wmi);			\
+				       &tunables->_attr, _wmi, _fsname);	\
 	}									\
 	static ssize_t _attr##_current_value_show(				\
 		struct kobject *kobj, struct kobj_attribute *attr, char *buf)	\
@@ -284,7 +286,7 @@ ssize_t armoury_attr_uint_show(struct kobject *kobj, struct kobj_attribute *attr
 		__ASUS_ATTR_RW(_attr, current_value)
 
 #define ASUS_ATTR_GROUP_ROG_TUNABLE(_attrname, _fsname, _wmi, _dispname)	\
-	__ROG_TUNABLE_RW(_attrname, _wmi);				\
+	__ROG_TUNABLE_RW(_attrname, _wmi, _fsname);			\
 	__ROG_TUNABLE_SHOW_DEFAULT(_attrname);				\
 	__ROG_TUNABLE_SHOW(min_value, _attrname, _attrname##_min);	\
 	__ROG_TUNABLE_SHOW(max_value, _attrname, _attrname##_max);	\
-- 
2.55.0



  reply	other threads:[~2026-08-28 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 11:12 [PATCH 0/2] platform/x86: asus-armoury: fix notifications for " Ahmed Yaseen
2026-08-28 11:12 ` Ahmed Yaseen [this message]
2026-08-28 11:12 ` [PATCH 2/2] platform/x86: asus-armoury: fix pending_reboot " Ahmed Yaseen

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=20260828111232.74443-2-yaseen@ghoul.dev \
    --to=yaseen@ghoul.dev \
    --cc=corentin.chary@gmail.com \
    --cc=denis.benato@linux.dev \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=mario.limonciello@amd.com \
    --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®