Skip to content

Commit b25d5a1

Browse files
jwrdegoederafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7c60610 commit b25d5a1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Documentation/ABI/testing/sysfs-platform_profile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ Contact: Hans de Goede <[email protected]>
2626
Description: Reading this file gives the current selected profile for this
2727
device. Writing this file with one of the strings from
2828
platform_profile_choices changes the profile to the new value.
29+
30+
This file can be monitored for changes by polling for POLLPRI,
31+
POLLPRI will be signalled on any changes, independent of those
32+
changes coming from a userspace write; or coming from another
33+
source such as e.g. a hotkey triggered profile change handled
34+
either directly by the embedded-controller or fully handled
35+
inside the kernel.

drivers/acpi/platform_profile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ static ssize_t platform_profile_store(struct device *dev,
106106
}
107107

108108
err = cur_profile->profile_set(cur_profile, i);
109+
if (!err)
110+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
111+
109112
mutex_unlock(&profile_lock);
110113
if (err)
111114
return err;

0 commit comments

Comments
 (0)