diff mbox series

[v9,19/22] ACPI: platform_profile: Notify class device from platform_profile_notify()

Message ID 20241202055031.8038-20-mario.limonciello@amd.com
State Superseded
Headers show
Series Add support for binding ACPI platform profile to multiple drivers | expand

Commit Message

Mario Limonciello Dec. 2, 2024, 5:50 a.m. UTC
When a driver has called platform_profile_notify() both the legacy sysfs
interface and the class device should be notified as userspace may listen
to either.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v8:
 * notify only one dev
---
 drivers/acpi/platform_profile.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ilpo Järvinen Dec. 5, 2024, 2:24 p.m. UTC | #1
On Sun, 1 Dec 2024, Mario Limonciello wrote:

> When a driver has called platform_profile_notify() both the legacy sysfs
> interface and the class device should be notified as userspace may listen
> to either.
> 
> Reviewed-by: Armin Wolf <W_Armin@gmx.de>
> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v8:
>  * notify only one dev
> ---
>  drivers/acpi/platform_profile.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
> index 16746d9b9aa7c..289b5d43638ae 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -401,6 +401,9 @@ void platform_profile_notify(struct platform_profile_handler *pprof)
>  {
>  	if (!cur_profile)
>  		return;
> +	scoped_cond_guard(mutex_intr, return, &profile_lock) {
> +		_notify_class_profile(pprof->class_dev, NULL);
> +	}
>  	sysfs_notify(acpi_kobj, NULL, "platform_profile");
>  }
>  EXPORT_SYMBOL_GPL(platform_profile_notify);

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index 16746d9b9aa7c..289b5d43638ae 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -401,6 +401,9 @@  void platform_profile_notify(struct platform_profile_handler *pprof)
 {
 	if (!cur_profile)
 		return;
+	scoped_cond_guard(mutex_intr, return, &profile_lock) {
+		_notify_class_profile(pprof->class_dev, NULL);
+	}
 	sysfs_notify(acpi_kobj, NULL, "platform_profile");
 }
 EXPORT_SYMBOL_GPL(platform_profile_notify);