summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-11-11 10:05:38 -0700
committerSimon Glass <sjg@chromium.org>2015-11-19 20:13:41 -0700
commita683d0d347f2977632c5b1b0b58ca1fa894fef9c (patch)
tree6a2a85af19c66e50db30bbe82156753e8174c543 /drivers/input
parentb1d7a1875e2f96417a2ecd7ebe1680f650c2be22 (diff)
downloadu-boot-imx-a683d0d347f2977632c5b1b0b58ca1fa894fef9c.zip
u-boot-imx-a683d0d347f2977632c5b1b0b58ca1fa894fef9c.tar.gz
u-boot-imx-a683d0d347f2977632c5b1b0b58ca1fa894fef9c.tar.bz2
input: Adjust structure of code in process_modifier()
Move all the '!release' code into one block so that it is clear that it only applies on key release. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index ceed5a6..a64bd87 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -236,7 +236,6 @@ static struct input_key_xlate *process_modifier(struct input_config *config,
int key, int release)
{
struct input_key_xlate *table;
- int flip = -1;
int i;
/* Start with the main table, and see what modifiers change it */
@@ -251,6 +250,8 @@ static struct input_key_xlate *process_modifier(struct input_config *config,
/* Handle the lighted keys */
if (!release) {
+ int flip = -1;
+
switch (key) {
case KEY_SCROLLLOCK:
flip = FLAG_SCROLL_LOCK;
@@ -262,19 +263,19 @@ static struct input_key_xlate *process_modifier(struct input_config *config,
flip = FLAG_CAPS_LOCK;
break;
}
- }
- if (flip != -1) {
- int leds = 0;
-
- config->leds ^= flip;
- if (config->flags & FLAG_NUM_LOCK)
- leds |= INPUT_LED_NUM;
- if (config->flags & FLAG_CAPS_LOCK)
- leds |= INPUT_LED_CAPS;
- if (config->flags & FLAG_SCROLL_LOCK)
- leds |= INPUT_LED_SCROLL;
- config->leds = leds;
+ if (flip != -1) {
+ int leds = 0;
+
+ config->leds ^= flip;
+ if (config->flags & FLAG_NUM_LOCK)
+ leds |= INPUT_LED_NUM;
+ if (config->flags & FLAG_CAPS_LOCK)
+ leds |= INPUT_LED_CAPS;
+ if (config->flags & FLAG_SCROLL_LOCK)
+ leds |= INPUT_LED_SCROLL;
+ config->leds = leds;
+ }
}
return table;