From patchwork Mon Oct 31 00:54:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 122696 X-Patchwork-Delegate: wd@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 6F94CB6F72 for ; Mon, 31 Oct 2011 11:54:53 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E33CE28AC8; Mon, 31 Oct 2011 01:54:49 +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 5eQcd+-OxfP6; Mon, 31 Oct 2011 01:54:49 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5AD1B28ACF; Mon, 31 Oct 2011 01:54:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BA37628ACF for ; Mon, 31 Oct 2011 01:54:46 +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 JTNTXApg6ETU for ; Mon, 31 Oct 2011 01:54:46 +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 smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by theia.denx.de (Postfix) with ESMTPS id 15E8828AC8 for ; Mon, 31 Oct 2011 01:54:44 +0100 (CET) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id B8F751B4006 for ; Mon, 31 Oct 2011 00:54:38 +0000 (UTC) From: Mike Frysinger To: u-boot@lists.denx.de Date: Sun, 30 Oct 2011 20:54:23 -0400 Message-Id: <1320022463-26410-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.7.6.1 Subject: [U-Boot] [PATCH] cmd_bdinfo: simplify local static funcs a bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 If we move the local funcs to the top of the file, and use the __maybe_unused define, we can drop a lot of ugly ifdef logic and duplicated prototypes. Signed-off-by: Mike Frysinger Acked-by: Simon Glass --- common/cmd_bdinfo.c | 89 ++++++++++++++++++-------------------------------- 1 files changed, 32 insertions(+), 57 deletions(-) diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index 688b238..67cb0da 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -26,24 +26,45 @@ */ #include #include +#include DECLARE_GLOBAL_DATA_PTR; -static void print_num(const char *, ulong); +__maybe_unused +static void print_num(const char *name, ulong value) +{ + printf("%-12s= 0x%08lX\n", name, value); +} -#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX)) \ - || defined(CONFIG_CMD_NET) -#define HAVE_PRINT_ETH -static void print_eth(int idx); -#endif +__maybe_unused +static void print_eth(int idx) +{ + char name[10], *val; + if (idx) + sprintf(name, "eth%iaddr", idx); + else + strcpy(name, "ethaddr"); + val = getenv(name); + if (!val) + val = "(not set)"; + printf("%-12s= %s\n", name, val); +} -#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86) && !defined(CONFIG_SANDBOX)) -#define HAVE_PRINT_LNUM -static void print_lnum(const char *, u64); -#endif +__maybe_unused +static void print_lnum(const char *name, u64 value) +{ + printf("%-12s= 0x%.8llX\n", name, value); +} + +__maybe_unused +static void print_mhz(const char *name, unsigned long hz) +{ + char buf[32]; + + printf("%-12s= %6s MHz\n", name, strmhz(buf, hz)); +} #if defined(CONFIG_PPC) -static void print_mhz(const char *, unsigned long); int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { @@ -208,8 +229,6 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) #elif defined(CONFIG_M68K) -static void print_mhz(const char *, unsigned long); - int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; @@ -257,8 +276,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #elif defined(CONFIG_BLACKFIN) -static void print_mhz(const char *, unsigned long); - int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; @@ -377,8 +394,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #elif defined(CONFIG_X86) -static void print_mhz(const char *, unsigned long); - int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; @@ -464,46 +479,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #error "a case for this architecture does not exist!" #endif -static void print_num(const char *name, ulong value) -{ - printf("%-12s= 0x%08lX\n", name, value); -} - -#ifdef HAVE_PRINT_ETH -static void print_eth(int idx) -{ - char name[10], *val; - if (idx) - sprintf(name, "eth%iaddr", idx); - else - strcpy(name, "ethaddr"); - val = getenv(name); - if (!val) - val = "(not set)"; - printf("%-12s= %s\n", name, val); -} -#endif - -#ifdef HAVE_PRINT_LNUM -static void print_lnum(const char *name, u64 value) -{ - printf("%-12s= 0x%.8llX\n", name, value); -} -#endif - -#if defined(CONFIG_PPC) || \ - defined(CONFIG_M68K) || \ - defined(CONFIG_BLACKFIN) || \ - defined(CONFIG_X86) -static void print_mhz(const char *name, unsigned long hz) -{ - char buf[32]; - - printf("%-12s= %6s MHz\n", name, strmhz(buf, hz)); -} -#endif /* CONFIG_PPC */ - - /* -------------------------------------------------------------------- */ U_BOOT_CMD(