diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-12-22 21:09:48 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-01-01 05:14:51 +0300 |
commit | 90b066b15eda028ed44299f01236f8576dd8551d (patch) | |
tree | 31f5d270508137734424f5f1474d35bc86976df5 /include/acpi | |
parent | 74bf8efb5fa6e958d2d7c7917b8bb672085ec0c6 (diff) | |
download | linux-90b066b15eda028ed44299f01236f8576dd8551d.tar.xz |
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>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/video.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/acpi/video.h b/include/acpi/video.h index c62392d9b52a..f11d342b4567 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -2,6 +2,7 @@ #define __ACPI_VIDEO_H #include <linux/errno.h> /* for ENODEV */ +#include <linux/types.h> /* for bool */ struct acpi_device; @@ -31,6 +32,7 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); +extern bool acpi_video_handles_brightness_key_presses(void); #else static inline int acpi_video_register(void) { return 0; } static inline void acpi_video_unregister(void) { return; } @@ -46,6 +48,10 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) { } +static inline bool acpi_video_handles_brightness_key_presses(void) +{ + return false; +} #endif #endif |