summary refs log tree commit diff
path: root/drivers/acpi/platform_profile.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2021-08-16 13:30:07 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-08-16 18:32:02 +0200
commitb25d5a1cd19896bb87b399d6e24896cf6f854d44 (patch)
treeb334601a18f581fea190dad06855bb7c4aecb6ad /drivers/acpi/platform_profile.c
parent7c60610d476766e128cc4284bb6349732cbd6606 (diff)
downloadlinux-b25d5a1cd19896bb87b399d6e24896cf6f854d44.tar.gz
ACPI: platform-profile: call sysfs_notify() from platform_profile_store()
Drivers like thinkpad_acpi and ideapad_laptop call the
platform_profile_notify() helper when the profile is changed by hardware
(the embedded-controller/EC) in response to an EC handled hotkey.

This allows userspace to monitor for such changes by polling for POLLPRI
on the platform_profile sysfs file. But the profile can also be changed
underneath a userspace program monitoring it by anonther userspace program
storing a new value.

Add a sysfs_notify() call to platform_profile_store(), so that userspace
programs monitoring for changes also get notified in this case.

Also update the documentation to document that POLLPRI polling can be
used to watch for changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/platform_profile.c')
-rw-r--r--drivers/acpi/platform_profile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index dd2fbf38e414..d418462ab791 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -106,6 +106,9 @@ static ssize_t platform_profile_store(struct device *dev,
 	}
 
 	err = cur_profile->profile_set(cur_profile, i);
+	if (!err)
+		sysfs_notify(acpi_kobj, NULL, "platform_profile");
+
 	mutex_unlock(&profile_lock);
 	if (err)
 		return err;