platform/x86: ideapad-laptop: add a mutex to synchronize VPC commands
authorGergo Koteles <soyer@irl.hu>
Thu, 25 Jul 2024 09:21:10 +0000 (11:21 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 8 Aug 2024 12:03:09 +0000 (15:03 +0300)
commit7cc06e729460a209b84d3db4db56c9f85f048cc2
treeccfcce50919593af44437bc6431e5040702f324c
parentcde7886b35176d56e72bfc68dc104fa08e7b072c
platform/x86: ideapad-laptop: add a mutex to synchronize VPC commands

Calling VPC commands consists of several VPCW and VPCR ACPI calls.
These calls and their results can get mixed up if they are called
simultaneously from different threads, like acpi notify handler,
sysfs, debugfs, notification chain.

The commit e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on
all CPUs") made the race issues much worse than before it but some
races were possible even before that commit.

Add a mutex to synchronize VPC commands.

Fixes: e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on all CPUs")
Fixes: e82882cdd241 ("platform/x86: Add driver for Yoga Tablet Mode switch")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/f26782fa1194ad11ed5d9ba121a804e59b58b026.1721898747.git.soyer@irl.hu
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/ideapad-laptop.c