All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 02/12] input: Adjust structure of code in process_modifier()
Date: Wed, 11 Nov 2015 10:05:38 -0700	[thread overview]
Message-ID: <1447261548-14304-3-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1447261548-14304-1-git-send-email-sjg@chromium.org>

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>
---

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

  parent reply	other threads:[~2015-11-11 17:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 17:05 [U-Boot] [PATCH v3 00/12] dm: input: Move keyboard drivers to driver model Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 01/12] input: Support the German keymap Simon Glass
2015-11-12  3:51   ` Bin Meng
2015-11-14  2:04     ` Simon Glass
2015-11-11 17:05 ` Simon Glass [this message]
2015-11-12 13:39   ` [U-Boot] [PATCH v3 02/12] input: Adjust structure of code in process_modifier() Bin Meng
2015-11-14  2:04     ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 03/12] input: Handle caps lock Simon Glass
2015-11-12 13:50   ` Bin Meng
2015-11-14  2:04     ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 04/12] input: Allow updating of keyboard LEDs Simon Glass
2015-11-12 13:50   ` Bin Meng
2015-11-14  2:04     ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 05/12] input: i8042: Convert to use the input library Simon Glass
2015-11-12 13:50   ` Bin Meng
2015-11-14  2:04     ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 06/12] input: Add a Kconfig option for the i8042 keyboard Simon Glass
2015-11-14  2:04   ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 07/12] x86: Add an i8042 device for boards that have it Simon Glass
2015-11-14  2:04   ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 08/12] Drop CONFIG_ISA_KEYBOARD Simon Glass
2015-11-14  2:04   ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 09/12] input: Convert i8042 to driver model Simon Glass
2015-11-12 13:50   ` Bin Meng
2015-11-14  2:04     ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 10/12] i8042: Handle a duplicate power-on-reset response Simon Glass
2015-11-14  2:04   ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 11/12] video: input: Clean up after i8042 conversion Simon Glass
2015-11-14  2:04   ` Simon Glass
2015-11-11 17:05 ` [U-Boot] [PATCH v3 12/12] input: Convert 'keyboard' driver to use input library Simon Glass
2015-11-14  2:04   ` Simon Glass
2015-11-11 21:56 ` [U-Boot] [PATCH v3 00/12] dm: input: Move keyboard drivers to driver model Simon Glass
2015-11-12  3:56   ` Bin Meng
2015-11-12 13:33     ` Bin Meng
2015-11-12 19:57       ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447261548-14304-3-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.