From patchwork Sun Mar 24 00:52:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 230360 X-Patchwork-Delegate: agust@denx.de 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 6D64D2C00B9 for ; Sun, 24 Mar 2013 11:52:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1B9234A026; Sun, 24 Mar 2013 01:52:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 LpL4B7+eFG64; Sun, 24 Mar 2013 01:52:05 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 802BE4A02A; Sun, 24 Mar 2013 01:52:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 48AF64A026 for ; Sun, 24 Mar 2013 01:52:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 4vUodJTMJq5x for ; Sun, 24 Mar 2013 01:52:00 +0100 (CET) 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-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 72F7C4A01B for ; Sun, 24 Mar 2013 01:51:57 +0100 (CET) Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3ZYKn86wVNz4KK2x; Sun, 24 Mar 2013 01:51:56 +0100 (CET) X-Auth-Info: MOUzx3LmFJCVeHAwnEBBe1Uskoy8ZtcWYZlvZOwiulA= Received: from localhost (p4FDE77CE.dip.t-dialin.net [79.222.119.206]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3ZYKn846hhzbh7k; Sun, 24 Mar 2013 01:51:56 +0100 (CET) From: Anatolij Gustschin To: u-boot@lists.denx.de, =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 24 Mar 2013 01:52:04 +0100 Message-Id: <1364086324-13515-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1364086240-13412-1-git-send-email-agust@denx.de> References: <1364086240-13412-1-git-send-email-agust@denx.de> Subject: [U-Boot] [PATCH] menu: export menu_default_choice() function X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- common/menu.c | 2 +- doc/README.menu | 5 +++++ include/menu.h | 1 + 3 files changed, 7 insertions(+), 1 deletions(-) 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);