Patchwork [U-Boot] menu: export menu_default_choice() function

login
register
mail settings
Submitter Anatolij Gustschin
Date March 24, 2013, 12:52 a.m.
Message ID <1364086324-13515-1-git-send-email-agust@denx.de>
Download mbox | patch
Permalink /patch/230360/
State Accepted
Delegated to: Anatolij Gustschin
Headers show

Comments

Anatolij Gustschin - March 24, 2013, 12:52 a.m.
Checking the default menu item and obtaining its data can
be useful in custom menu code. Export menu_default_choice()
function which serves this purpose.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 common/menu.c   |    2 +-
 doc/README.menu |    5 +++++
 include/menu.h  |    1 +
 3 files changed, 7 insertions(+), 1 deletions(-)
Anatolij Gustschin - March 28, 2013, 3:26 p.m.
On Sun, 24 Mar 2013 01:52:04 +0100
Anatolij Gustschin <agust@denx.de> wrote:

> Checking the default menu item and obtaining its data can
> be useful in custom menu code. Export menu_default_choice()
> function which serves this purpose.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  common/menu.c   |    2 +-
>  doc/README.menu |    5 +++++
>  include/menu.h  |    1 +
>  3 files changed, 7 insertions(+), 1 deletions(-)

applied to staging/agust@denx.de. Thanks.

Anatolij

Patch

diff --git a/common/menu.c b/common/menu.c
index 322b75e..64b461a 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -176,7 +176,7 @@  static inline struct menu_item *menu_item_by_key(struct menu *m,
  * Set *choice to point to the default item's data, if any default item was
  * set, and returns 1. If no default item was set, returns -ENOENT.
  */
-static inline int menu_default_choice(struct menu *m, void **choice)
+int menu_default_choice(struct menu *m, void **choice)
 {
 	if (m->default_item) {
 		*choice = m->default_item->data;
diff --git a/doc/README.menu b/doc/README.menu
index c949398..a8999ca 100644
--- a/doc/README.menu
+++ b/doc/README.menu
@@ -66,6 +66,11 @@  int menu_item_add(struct menu *m, char *item_key, void *item_data);
 int menu_default_set(struct menu *m, char *item_key);
 
 /*
+ * menu_default_choice() - Set *choice to point to the default item's data
+ */
+int menu_default_choice(struct menu *m, void **choice);
+
+/*
  * menu_get_choice() - Returns the user's selected menu entry, or the
  * default if the menu is set to not prompt or the timeout expires.
  */
diff --git a/include/menu.h b/include/menu.h
index f4dd5af..d8200ee 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -29,6 +29,7 @@  int menu_get_choice(struct menu *m, void **choice);
 int menu_item_add(struct menu *m, char *item_key, void *item_data);
 int menu_destroy(struct menu *m);
 void menu_display_statusline(struct menu *m);
+int menu_default_choice(struct menu *m, void **choice);
 
 #if defined(CONFIG_MENU_SHOW)
 int menu_show(int bootdelay);