From patchwork Wed Sep 9 04:32:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 515696 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 7FB38140497 for ; Wed, 9 Sep 2015 14:43:04 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=f4kqsk8E; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 221674B7F6; Wed, 9 Sep 2015 06:42:53 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id abqtg0zkO9PL; Wed, 9 Sep 2015 06:42:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2E60F4B7FC; Wed, 9 Sep 2015 06:42:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6CD174B796 for ; Wed, 9 Sep 2015 06:42:19 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R8crPxPWlX8k for ; Wed, 9 Sep 2015 06:42:19 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) by theia.denx.de (Postfix) with ESMTPS id 098014B71C for ; Wed, 9 Sep 2015 06:42:15 +0200 (CEST) Received: by ioii196 with SMTP id i196so9079720ioi.3 for ; Tue, 08 Sep 2015 21:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=0rQvWGO/QHubOgZGg1nLGVrCLNxCe7TvJQ/bja8vSWs=; b=f4kqsk8EhviL+9oKCMb2nec9V9U9mh6H9k/tOMBW5ZvHj7AvVjdHv+t7W09OzzTDuv ARObS4j5dSjf0LhjySfiGT5Z/OJyCzK+OoPKwT1GlGyolc2Tr0s59OO29yD5ul/0fmsG eOsyLEWNw8Nq6RxK+hbff111IRTtvRj45bhyD7O1GnnWWbPL4CXdv5QFR8rICi/uN0gI demgt41yDZv/eQ/FdKCHqbcWrU8X2UxyzDmjzInOhe2PtVTQ6xHbvUGYyzC/n1GZXJuQ S7JqXFRwE72lGInOrH3/nytkL/kF4qsXrc94p9JhARuAZbzcRnOPIXwQN2RA6KV0qrT7 Xnvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=0rQvWGO/QHubOgZGg1nLGVrCLNxCe7TvJQ/bja8vSWs=; b=ciPqeXYRwu/o52zTAUKV0pnCBc0i7wN7rszNM4gtaPc2EYJC5DeZirAEg3btSv+reR 6DLHf7L9keSqUSj45UVsSS39FssUIATcJTBcr5+4w1uSVhfkul4xiSBaveixfBSGfnCs ND4rlsq0XM+EdDGurlbhLCAn5BWDYSbSnhu6Pldn4HAq9GnfgGKjJcXU8zJRy+19xnp7 hcCij2g0fdsJoWGW5lSTuOlTW/3X8cMtEk2RIpKJ8Iv2d/njokChAPBQY1N7kWaaR5ae MCPdn/5fWWaPyB9vlhUcMeUMxsYg0eKwy5vvdyxMI08YCDLz/fHN7WYqNNKwQwDuOi6a Kl5A== X-Gm-Message-State: ALoCoQl3uXFlbyw7i93eEmCt5rJb3nlPMuNc1LcqXJQ/b/yT4HVkUuQKuggu2FHbc3Gk2T98xgYB X-Received: by 10.107.161.144 with SMTP id k138mr49648565ioe.47.1441773734818; Tue, 08 Sep 2015 21:42:14 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:29c2:aacf:f3d3:bb56]) by smtp.gmail.com with ESMTPSA id nj8sm972036igb.1.2015.09.08.21.42.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 21:42:13 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 24410221917; Tue, 8 Sep 2015 22:33:20 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 8 Sep 2015 22:32:42 -0600 Message-Id: <1441773171-4575-20-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc0.131.gf624c3d In-Reply-To: <1441773171-4575-1-git-send-email-sjg@chromium.org> References: <1441773171-4575-1-git-send-email-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 19/28] input: Adjust structure of code in process_modifier() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- 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;