]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:08:46 +0000 (11:08 +0100)
commit02e92557b3075b9d0e02dc8551ea14ac5955b996
tree246dabd02ffc925b1462f7a690daee936e3f49b2
parentdd7992a5f7448ba33892151784c26b93fe005cfe
ACPI: button: fix handling lid state changes when input device closed

commit 21988a8e51479ceffe7b0568b170effabb708dfe upstream.

The original intent of 84d3f6b76447 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: 84d3f6b76447 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/button.c