summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/thinkpad_acpi.c
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2023-07-04 23:03:17 +0200
committerHans de Goede <hdegoede@redhat.com>2023-07-12 17:48:08 +0200
commitce55dbe55f31c54811e0685c56252eb75f38d31e (patch)
tree9919a0cc764bbf5d008d42f27ee8d21403e17fda /drivers/platform/x86/thinkpad_acpi.c
parente0b278e7b5da62c3ebb156a8b7d76a739da2d953 (diff)
downloadlinux-stable-ce55dbe55f31c54811e0685c56252eb75f38d31e.tar.gz
linux-stable-ce55dbe55f31c54811e0685c56252eb75f38d31e.tar.bz2
linux-stable-ce55dbe55f31c54811e0685c56252eb75f38d31e.zip
platform/x86: thinkpad_acpi: take mutex for hotkey_mask_{set,get}
hotkey_mask_set() and hotkey_mask_get() expect hotkey_mutex to be held. While it should not matter during initialization a following patch will enable lockdep for hotkey_mutex which would produce warnings here. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20230704-thinkpad_acpi-lockdep-v1-1-60129548a738@weissschuh.net Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 187018ffb068..b796e65c99e0 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3478,7 +3478,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
if (tp_features.hotkey_mask) {
/* hotkey_source_mask *must* be zero for
* the first hotkey_mask_get to return hotkey_orig_mask */
+ mutex_lock(&hotkey_mutex);
res = hotkey_mask_get();
+ mutex_unlock(&hotkey_mutex);
if (res)
return res;
@@ -3577,9 +3579,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
hotkey_exit();
return res;
}
+ mutex_lock(&hotkey_mutex);
res = hotkey_mask_set(((hotkey_all_mask & ~hotkey_reserved_mask)
| hotkey_driver_mask)
& ~hotkey_source_mask);
+ mutex_unlock(&hotkey_mutex);
if (res < 0 && res != -ENXIO) {
hotkey_exit();
return res;