From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
To: rafael@kernel.org
Cc: "Len Brown" <lenb@kernel.org>, "Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Maximilian Luz" <luzmaximilian@gmail.com>,
"Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
"Daniel Lezcano" <daniel.lezcano@kernel.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Armin Wolf" <W_Armin@gmx.de>,
"Jai Luthra" <jai.luthra@ideasonboard.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Mario Limonciello (AMD)" <superm1@kernel.org>,
"Jack Wu" <jackbb_wu@compal.com>,
"Mario Limonciello" <mario.limonciello@amd.com>,
"Zhang DM" <jixianqiang1540@gmail.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, linux-pm@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Subject: [PATCH v2 3/5] platform profile: Complete class notifications and registration cleanup
Date: Mon, 19 Oct 2026 09:39:06 +0200 [thread overview]
Message-ID: <20261019073930.2352283-4-daniel.lezcano@oss.qualcomm.com> (raw)
In-Reply-To: <20261019073930.2352283-1-daniel.lezcano@oss.qualcomm.com>
The class profile attribute documents POLLPRI notifications for changes
made through userspace writes as well as changes reported by providers.
However, a direct write currently notifies only the legacy ACPI aggregate
attribute, leaving listeners on the provider's own profile attribute
unaware of the change.
Notify the class device after a successful direct write, using the same
helper as aggregate writes and provider-originated notifications. This
also makes notifications available when ACPI is absent or disabled.
Restore aggregate attribute visibility after unlinking a handler whose
registration failed during a sysfs group update. Keep aggregation exposed
only through the existing ACPI interface; the existing class devices
provide firmware-independent userspace access.
Assisted-by: OpenCode:gpt-6.1-sol
Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
---
drivers/platform/profile/core.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/profile/core.c b/drivers/platform/profile/core.c
index f18fd96b942c..320a5a964fea 100644
--- a/drivers/platform/profile/core.c
+++ b/drivers/platform/profile/core.c
@@ -250,6 +250,7 @@ static ssize_t profile_store(struct device *dev,
ret = _store_class_profile(dev, &index);
if (ret)
return ret;
+ _notify_class_profile(dev, NULL);
}
profile_notify();
@@ -324,7 +325,7 @@ static int _remove_hidden_choices(struct device *dev, void *arg)
}
/**
- * platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
+ * platform_profile_choices_show - Show the aggregate profile choices
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to write to
@@ -360,7 +361,7 @@ static ssize_t platform_profile_choices_show(struct kobject *kobj,
}
/**
- * _aggregate_profiles - Aggregate the profiles for legacy sysfs interface
+ * _aggregate_profiles - Aggregate the profiles across providers
* @dev: The device
* @data: The profile to return
*
@@ -385,7 +386,7 @@ static int _aggregate_profiles(struct device *dev, void *data)
}
/**
- * _store_and_notify - Store and notify a class from legacy sysfs interface
+ * _store_and_notify - Store and notify a provider from an aggregate write
* @dev: The device
* @data: The profile to return
*
@@ -403,7 +404,7 @@ static int _store_and_notify(struct device *dev, void *data)
}
/**
- * platform_profile_show - Show the current profile for legacy sysfs interface
+ * platform_profile_show - Show the current aggregate profile
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to write to
@@ -431,7 +432,7 @@ static ssize_t platform_profile_show(struct kobject *kobj,
}
/**
- * platform_profile_store - Set the profile for legacy sysfs interface
+ * platform_profile_store - Set the profile across all providers
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to read from
@@ -502,7 +503,7 @@ static int profile_update(void)
}
/**
- * platform_profile_notify - Notify class device and legacy sysfs interface
+ * platform_profile_notify - Notify the provider and aggregate sysfs interfaces
* @dev: The class device
*/
void platform_profile_notify(struct device *dev)
@@ -643,6 +644,7 @@ struct device *platform_profile_register(struct device *dev, const char *name,
cleanup_cur:
scoped_guard(mutex, &profile_lock)
list_del(&to_pprof_handler(ppdev)->node);
+ profile_update();
device_unregister(ppdev);
cleanup_ida:
--
2.43.0
next prev parent reply other threads:[~2026-10-19 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 7:39 [PATCH v2 0/5] Make platform profiles firmware independent Daniel Lezcano
2026-10-19 7:39 ` [PATCH v2 1/5] platform profile: Separate handler locking from sysfs lifetime Daniel Lezcano
2026-10-19 8:50 ` Ilpo Järvinen
2026-10-19 18:12 ` Rafael J. Wysocki (Intel)
2026-10-19 7:39 ` [PATCH v2 2/5] platform profile: Extract the core from ACPI Daniel Lezcano
2026-10-19 7:39 ` Daniel Lezcano [this message]
2026-10-19 7:39 ` [PATCH v2 4/5] platform profile: Document firmware-independent profile selection Daniel Lezcano
2026-10-19 7:39 ` [PATCH v2 5/5] platform profile: Make legacy ACPI aggregate interface optional Daniel Lezcano
2026-10-19 19:02 ` Mario Limonciello
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=20261019073930.2352283-4-daniel.lezcano@oss.qualcomm.com \
--to=daniel.lezcano@oss.qualcomm.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=W_Armin@gmx.de \
--cc=corbet@lwn.net \
--cc=daniel.lezcano@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jackbb_wu@compal.com \
--cc=jai.luthra@ideasonboard.com \
--cc=jixianqiang1540@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=luzmaximilian@gmail.com \
--cc=mario.limonciello@amd.com \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=skhan@linuxfoundation.org \
--cc=superm1@kernel.org \
--cc=viresh.kumar@linaro.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®