]> 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, 10 Oct 2024 10:00:17 +0000 (12:00 +0200)
commit34ca57debd0be89b5c333d2df71bdd3c51612c28
treecac46c3295ad963cb6bf37a6e0d8c88bfb246f59
parent8f496c99120bbe2dee4238d02a1d2a5d4fb764bb
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