[U-Boot] [PATCH 19/28] input: Adjust structure of code in process_modifier()
Simon Glass
sjg at chromium.org
Wed Sep 9 06:32:42 CEST 2015
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 at chromium.org>
---
drivers/input/input.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index a54449e..256845f 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -208,7 +208,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 */
@@ -223,6 +222,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;
@@ -234,19 +235,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;
--
2.6.0.rc0.131.gf624c3d
More information about the U-Boot
mailing list