OSDN Git Service

ACPI / video: Add a acpi_video_handles_brightness_key_presses() helper
authorHans de Goede <hdegoede@redhat.com>
Tue, 22 Dec 2015 18:09:48 +0000 (19:09 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 1 Jan 2016 02:14:51 +0000 (03:14 +0100)
commit90b066b15eda028ed44299f01236f8576dd8551d
tree31f5d270508137734424f5f1474d35bc86976df5
parent74bf8efb5fa6e958d2d7c7917b8bb672085ec0c6
ACPI / video: Add a acpi_video_handles_brightness_key_presses() helper

Several drivers want to know if the acpi-video is generating key-presses
for brightness change hotkeys to avoid sending double key-events to
userspace for these. Currently these driver use this construct for this:

if (acpi_video_get_backlight_type() == acpi_backlight_vendor)
report_brightness_key_event();

This indirect way of detecting if acpi-video is active does not make the
code easier to understand, and in some cases it is wrong because just
because the preferred type != vendor does not mean that acpi-video is
actually listening for brightness events, e.g. there may be no acpi-video
bus on the system at all.

This commit adds a acpi_video_handles_brightness_key_presses() helper
function, making the code needing this functionality both easier to read
and more correct.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpi_video.c
include/acpi/video.h