[ar71xx] create firmware image for the Ubiquiti LS-SR71 board
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1096-Simplify-the-code-there-is-no-need-for-a-branch.-Th.patch
1 From ca5c103515f48dc5d0d910847fb38a652d70a093 Mon Sep 17 00:00:00 2001
2 From: Holger Freyther <zecke@openmoko.org>
3 Date: Fri, 25 Jul 2008 23:06:02 +0100
4 Subject: [PATCH] Simplify the code, there is no need for a branch. The code for
5 GTA01_GPIO_AUX_KEY looks odd.
6
7 Signed-Off-by: Holger Freyther <zecke@openmoko.org>
8 ---
9 drivers/input/keyboard/neo1973kbd.c | 24 +++++++-----------------
10 1 files changed, 7 insertions(+), 17 deletions(-)
11
12 diff --git a/drivers/input/keyboard/neo1973kbd.c b/drivers/input/keyboard/neo1973kbd.c
13 index 917d5ae..99ca9c3 100644
14 --- a/drivers/input/keyboard/neo1973kbd.c
15 +++ b/drivers/input/keyboard/neo1973kbd.c
16 @@ -37,11 +37,8 @@ static irqreturn_t neo1973kbd_aux_irq(int irq, void *dev_id)
17 struct neo1973kbd *neo1973kbd_data = dev_id;
18
19 /* FIXME: use GPIO from platform_dev resources */
20 - if (s3c2410_gpio_getpin(GTA01_GPIO_AUX_KEY))
21 - input_report_key(neo1973kbd_data->input, KEY_PHONE, 0);
22 - else
23 - input_report_key(neo1973kbd_data->input, KEY_PHONE, 1);
24 -
25 + int key_pressed = !s3c2410_gpio_getpin(GTA01_GPIO_AUX_KEY);
26 + input_report_key(neo1973kbd_data->input, KEY_PHONE, key_pressed);
27 input_sync(neo1973kbd_data->input);
28
29 return IRQ_HANDLED;
30 @@ -52,11 +49,8 @@ static irqreturn_t neo1973kbd_hold_irq(int irq, void *dev_id)
31 struct neo1973kbd *neo1973kbd_data = dev_id;
32
33 /* FIXME: use GPIO from platform_dev resources */
34 - if (s3c2410_gpio_getpin(GTA01_GPIO_HOLD_KEY))
35 - input_report_key(neo1973kbd_data->input, KEY_PAUSE, 1);
36 - else
37 - input_report_key(neo1973kbd_data->input, KEY_PAUSE, 0);
38 -
39 + int key_pressed = 3c2410_gpio_getpin(GTA01_GPIO_HOLD_KEY);
40 + input_report_key(neo1973kbd_data->input, KEY_PAUSE, key_pressed);
41 input_sync(neo1973kbd_data->input);
42
43 return IRQ_HANDLED;
44 @@ -67,13 +61,9 @@ static irqreturn_t neo1973kbd_headphone_irq(int irq, void *dev_id)
45 struct neo1973kbd *neo1973kbd_data = dev_id;
46
47 /* FIXME: use GPIO from platform_dev resources */
48 - if (s3c2410_gpio_getpin(GTA01_GPIO_JACK_INSERT))
49 - input_report_switch(neo1973kbd_data->input,
50 - SW_HEADPHONE_INSERT, 1);
51 - else
52 - input_report_switch(neo1973kbd_data->input,
53 - SW_HEADPHONE_INSERT, 0);
54 -
55 + int key_pressed = s3c2410_gpio_getpin(GTA01_GPIO_JACK_INSERT);
56 + input_report_switch(neo1973kbd_data->input,
57 + SW_HEADPHONE_INSERT, key_pressed);
58 input_sync(neo1973kbd_data->input);
59
60 return IRQ_HANDLED;
61 --
62 1.5.6.3
63
This page took 0.053726 seconds and 5 git commands to generate.