From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED645C77B7A for ; Sun, 11 Jun 2023 12:54:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7FD1886197; Sun, 11 Jun 2023 14:53:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="TpQDPMfN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E69B085E7D; Sun, 11 Jun 2023 14:53:48 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1E1C68466B for ; Sun, 11 Jun 2023 14:53:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8709C61130; Sun, 11 Jun 2023 12:53:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB4D0C4339C; Sun, 11 Jun 2023 12:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686488021; bh=OJFQBSn2Hgi2v+pk7OXuQxFrdTi0IHLlkA5U+oKt+lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TpQDPMfNFztQCM516n24ySYLgg/XkhkfVr/YtMvgNYZUrANuqM6aKlDRU4EmSYDdg Ml5fwjytULUtjczeFR+SolT7Nusef/4SSNGpw7n/ekv/TDPq/et6YJ8NblJ3S4QD/9 h4G+qcW07ABZgQzADZwb8VrtGvuB2Oj8sRHccFLxt2oLj3g8nYdbyRHA7x5rwqOOtm Bpgjln2DF7iImk7zbYsd/U2E6zcHuRwFtt+BkRBhfctB1K0p1pPFbUyuZ7/24s2BxT cRe6fAwQHtzCxGvLvYqJnpgohJ9TOz9YXm2G4byMvS1iVeSj4Bu5RS+GMSMW9cZZuE W8YXkK5gqPpTg== Received: by pali.im (Postfix) id F27D3D48; Sun, 11 Jun 2023 14:53:38 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Tom Rini , Stefan Roese Cc: u-boot@lists.denx.de Subject: [PATCH u-boot 2/3] Revert "menu: Factor out menu-keypress decoding" Date: Sun, 11 Jun 2023 14:53:23 +0200 Message-Id: <20230611125324.15860-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230611125324.15860-1-pali@kernel.org> References: <20230611125324.15860-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This reverts commit 9e7ac0b0be5cb663e539716554d66f8f0890ca83. Signed-off-by: Pali Rohár --- common/menu.c | 48 ++++++++++++++++++------------------------------ include/menu.h | 10 ---------- 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/common/menu.c b/common/menu.c index 94514177e4e9..b6ec2e9c616c 100644 --- a/common/menu.c +++ b/common/menu.c @@ -483,11 +483,26 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, return key; } -enum bootmenu_key bootmenu_conv_key(int ichar) +enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, + struct cli_ch_state *cch) { - enum bootmenu_key key; + enum bootmenu_key key = BKEY_NONE; + int c; + + c = cli_ch_process(cch, 0); + if (!c) { + while (!c && !tstc()) { + schedule(); + mdelay(10); + c = cli_ch_process(cch, -ETIMEDOUT); + } + if (!c) { + c = getchar(); + c = cli_ch_process(cch, c); + } + } - switch (ichar) { + switch (c) { case '\n': /* enter key was pressed */ key = BKEY_SELECT; @@ -515,34 +530,7 @@ enum bootmenu_key bootmenu_conv_key(int ichar) case ' ': key = BKEY_SPACE; break; - default: - key = BKEY_NONE; - break; - } - - return key; -} - -enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, - struct cli_ch_state *cch) -{ - enum bootmenu_key key; - int c; - - c = cli_ch_process(cch, 0); - if (!c) { - while (!c && !tstc()) { - schedule(); - mdelay(10); - c = cli_ch_process(cch, -ETIMEDOUT); - } - if (!c) { - c = getchar(); - c = cli_ch_process(cch, c); - } } - key = bootmenu_conv_key(c); - return key; } diff --git a/include/menu.h b/include/menu.h index 64ce89b7d263..5e54f033dfa4 100644 --- a/include/menu.h +++ b/include/menu.h @@ -54,8 +54,6 @@ enum bootmenu_key { BKEY_MINUS, BKEY_SPACE, BKEY_SAVE, - - BKEY_COUNT, }; /** @@ -104,12 +102,4 @@ enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, struct cli_ch_state *cch); -/** - * bootmenu_conv_key() - Convert a U-Boot keypress into a menu key - * - * @ichar: Keypress to convert (ASCII, including control characters) - * Returns: Menu key that corresponds to @ichar, or BKEY_NONE if none - */ -enum bootmenu_key bootmenu_conv_key(int ichar); - #endif /* __MENU_H__ */ -- 2.20.1