]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: button: fix handling lid state changes when input device closed
authordmitry.torokhov@gmail.com <dmitry.torokhov@gmail.com>
Mon, 5 Oct 2020 05:11:25 +0000 (22:11 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 5 Oct 2020 11:22:54 +0000 (13:22 +0200)
commitae5854992f2893ff4755b67e9e6e8bf44e30d7a8
treeb5e7e7a4d9ae37ceae564e5aef14b0dc475b3a6b
parent8d14aede3a4dea0a8529c8aa849876125c838e4b
ACPI: button: fix handling lid state changes when input device closed

The original intent of 8d00c358d45d was to delay evaluating lid state until
all drivers have been loaded, with input device being opened from userspace
serving as a signal for this condition. Let's ensure that state updates
happen even if userspace closed (or in the future inhibited) input device.

Note that if we go through suspend/resume cycle we assume the system has
been fully initialized even if LID input device has not been opened yet.

This has a side-effect of fixing access to input->users outside of
input->mutex protections by the way of eliminating said accesses and using
driver private flag.

Fixes: 8d00c358d45d ("ACPI / button: Delay acpi_lid_initialize_state() until first user space open")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Cc: 4.15+ <stable@vger.kernel.org> # 4.15+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/button.c