From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 11 Nov 2015 10:05:38 -0700 Subject: [U-Boot] [PATCH v3 02/12] input: Adjust structure of code in process_modifier() In-Reply-To: <1447261548-14304-1-git-send-email-sjg@chromium.org> References: <1447261548-14304-1-git-send-email-sjg@chromium.org> Message-ID: <1447261548-14304-3-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes in v3: None Changes in v2: None 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 96fc195..7513226 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -237,7 +237,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 */ @@ -252,6 +251,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; @@ -263,19 +264,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.rc2.230.g3dd15c0