summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/fujitsu-laptop.c
diff options
context:
space:
mode:
authorMichał Kępień <kernel@kempniu.pl>2017-03-01 09:42:53 +0300
committerDarren Hart <dvhart@infradead.org>2017-03-15 08:57:14 +0300
commit5efc800463bc340abf6b5e7abd84f7a9522a428d (patch)
treefdbde647b0b38fd5e34d687509e623c8219991ed /drivers/platform/x86/fujitsu-laptop.c
parent1f3bc53d843f92d6e7e7cf56ee79acec918e6421 (diff)
downloadlinux-5efc800463bc340abf6b5e7abd84f7a9522a428d.tar.xz
platform/x86: fujitsu-laptop: decrease indentation in acpi_fujitsu_bl_notify()
acpi_fujitsu_bl_notify() is pretty deeply nested, which hurts readability. Strip off one level of indentation by returning early when the event code supplied as argument is not ACPI_FUJITSU_NOTIFY_CODE1. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
Diffstat (limited to 'drivers/platform/x86/fujitsu-laptop.c')
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index e12cc3504d48..b19f6e1c0173 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -795,40 +795,42 @@ static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event)
input = fujitsu_bl->input;
- switch (event) {
- case ACPI_FUJITSU_NOTIFY_CODE1:
- keycode = 0;
- oldb = fujitsu_bl->brightness_level;
- get_lcd_level();
- newb = fujitsu_bl->brightness_level;
-
- vdbg_printk(FUJLAPTOP_DBG_TRACE,
- "brightness button event [%i -> %i (%i)]\n",
- oldb, newb, fujitsu_bl->brightness_changed);
-
- if (oldb < newb) {
- if (disable_brightness_adjust != 1) {
- if (use_alt_lcd_levels)
- set_lcd_level_alt(newb);
- else
- set_lcd_level(newb);
- }
- keycode = KEY_BRIGHTNESSUP;
- } else if (oldb > newb) {
- if (disable_brightness_adjust != 1) {
- if (use_alt_lcd_levels)
- set_lcd_level_alt(newb);
- else
- set_lcd_level(newb);
- }
- keycode = KEY_BRIGHTNESSDOWN;
- }
- break;
- default:
+ if (event != ACPI_FUJITSU_NOTIFY_CODE1) {
keycode = KEY_UNKNOWN;
vdbg_printk(FUJLAPTOP_DBG_WARN,
"unsupported event [0x%x]\n", event);
- break;
+ input_report_key(input, keycode, 1);
+ input_sync(input);
+ input_report_key(input, keycode, 0);
+ input_sync(input);
+ return;
+ }
+
+ keycode = 0;
+ oldb = fujitsu_bl->brightness_level;
+ get_lcd_level();
+ newb = fujitsu_bl->brightness_level;
+
+ vdbg_printk(FUJLAPTOP_DBG_TRACE,
+ "brightness button event [%i -> %i (%i)]\n",
+ oldb, newb, fujitsu_bl->brightness_changed);
+
+ if (oldb < newb) {
+ if (disable_brightness_adjust != 1) {
+ if (use_alt_lcd_levels)
+ set_lcd_level_alt(newb);
+ else
+ set_lcd_level(newb);
+ }
+ keycode = KEY_BRIGHTNESSUP;
+ } else if (oldb > newb) {
+ if (disable_brightness_adjust != 1) {
+ if (use_alt_lcd_levels)
+ set_lcd_level_alt(newb);
+ else
+ set_lcd_level(newb);
+ }
+ keycode = KEY_BRIGHTNESSDOWN;
}
if (keycode != 0) {