]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI / video: driver must be registered before checking for keypresses
authorAdrien Schildknecht <adrien+dev@schischi.me>
Mon, 4 Jan 2016 22:22:28 +0000 (23:22 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 Jan 2016 12:38:50 +0000 (13:38 +0100)
commit7b421ad5f95ea5651ad22e0d440ed178c914c9f9
tree002e2aea096bdb9c1f335f37bfe2ff7c19547c37
parent3debd7005bcd459490cdb90b8079dff040855236
ACPI / video: driver must be registered before checking for keypresses

acpi_video_handles_brightness_key_presses() may use an uninitialized mutex.
The error has been reported by lockdep: DEBUG_LOCKS_WARN_ON(l->magic != l).
The function assumes that the video driver has been registered before being
called. As explained in the comment of acpi_video_init(), the registration
of the video class may be defered and thus may not take place in the init
function of the module.

Use completion mechanisms to make sure that
acpi_video_handles_brightness_key_presses() wait for the completion of
acpi_video_register() before using the mutex.
Also get rid of register_count since task completion can replace it.

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpi_video.c