public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Tom Rini <trini@konsulko.com>, Stefan Roese <sr@denx.de>
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	[thread overview]
Message-ID: <20230611125324.15860-3-pali@kernel.org> (raw)
In-Reply-To: <20230611125324.15860-1-pali@kernel.org>

This reverts commit 9e7ac0b0be5cb663e539716554d66f8f0890ca83.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 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


  parent reply	other threads:[~2023-06-11 12:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-11 12:53 [PATCH u-boot 0/3] Revert broken Bootmenu commits Pali Rohár
2023-06-11 12:53 ` [PATCH u-boot 1/3] Revert "video: Enable VIDEO_ANSI by default only with EFI" Pali Rohár
2023-06-11 12:53 ` Pali Rohár [this message]
2023-06-11 12:53 ` [PATCH u-boot 3/3] Revert "menu: Make use of CLI character processing" Pali Rohár
2023-06-14 19:51 ` [PATCH u-boot 0/3] Revert broken Bootmenu commits Tom Rini
2023-06-20 10:20   ` Simon Glass
2023-06-24  8:50     ` Pali Rohár
2023-06-24 16:58       ` Tom Rini
2023-06-25  7:50         ` Pali Rohár
2023-06-25 14:52           ` Tom Rini
2023-06-25 15:15             ` Pali Rohár
2023-06-26  1:08               ` Tom Rini
2023-07-10 14:10                 ` Pali Rohár
2023-07-10 14:17                   ` Simon Glass
2023-07-10 15:17                   ` Tom Rini
2023-07-10 16:03                     ` Stefan Roese
2023-07-13 15:12                       ` Stefan Roese

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=20230611125324.15860-3-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox