]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ACPI: EC: Do not release locks during operation region accesses
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 4 Jul 2024 16:26:54 +0000 (18:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:25 +0000 (15:11 +0200)
commitd6e279a091582403f4ebefff9967af9d6d3a30ec
treeec1d4e4902d92e9892bbe9ff94da564cfcbc9ec1
parent7df619575dc556f5bf1096e1aed996709050f253
ACPI: EC: Do not release locks during operation region accesses

[ Upstream commit dc171114926ec390ab90f46534545420ec03e458 ]

It is not particularly useful to release locks (the EC mutex and the
ACPI global lock, if present) and re-acquire them immediately thereafter
during EC address space accesses in acpi_ec_space_handler().

First, releasing them for a while before grabbing them again does not
really help anyone because there may not be enough time for another
thread to acquire them.

Second, if another thread successfully acquires them and carries out
a new EC write or read in the middle if an operation region access in
progress, it may confuse the EC firmware, especially after the burst
mode has been enabled.

Finally, manipulating the locks after writing or reading every single
byte of data is overhead that it is better to avoid.

Accordingly, modify the code to carry out EC address space accesses
entirely without releasing the locks.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patch.msgid.link/12473338.O9o76ZdvQC@rjwysocki.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/ec.c