From patchwork Thu Jul 13 13:09:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 787730 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3x7bsj1pBtz9s0g for ; Thu, 13 Jul 2017 23:15:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EF8D9C21EB4; Thu, 13 Jul 2017 13:11:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D07D6C21E40; Thu, 13 Jul 2017 13:10:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9340BC21E3C; Thu, 13 Jul 2017 13:09:58 +0000 (UTC) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lists.denx.de (Postfix) with ESMTPS id EFE4FC21E47 for ; Thu, 13 Jul 2017 13:09:54 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3x7bks3619z9ttCH; Thu, 13 Jul 2017 15:09:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id emNUZYj-UxGB; Thu, 13 Jul 2017 15:09:41 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3x7bks2cX5z9ttC8; Thu, 13 Jul 2017 15:09:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 872048B880; Thu, 13 Jul 2017 15:09:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id szsg_PuvdbUF; Thu, 13 Jul 2017 15:09:54 +0200 (CEST) Received: from pc13941vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.8]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5B8A18B7FF; Thu, 13 Jul 2017 15:09:54 +0200 (CEST) Received: by pc13941vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 43606674EB; Thu, 13 Jul 2017 15:09:54 +0200 (CEST) Message-Id: <7bf94f97ca5a10cd1a9f6c34545d38cb01a40dfd.1499945943.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy To: Wolfgang Denk , Heiko Schocher , Tom Rini , York Sun Date: Thu, 13 Jul 2017 15:09:54 +0200 (CEST) Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 06/14] powerpc: Remove unneccessary #ifdefs in reginfo X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" reginfo command is calling mpc8xx_reginfo(), mpc85xx_reginfo() or mpc86xx_reginfo() based on CONFIG_ symbol. As those 3 functions can't me defined at the same time, let's rename them print_reginfo() to avoid the #ifdefs The name is kept generic as it is not at all dependent on powerpc arch and any other arch could want to also print such information. In addition, as the Makefile compiles cmd/reginfo.c only when CONFIG_CMD_REGINFO is set, there is no need to enclose the U_BOOT_CMD definition inside a #ifdef CONFIG_CMD_REGINFO Lets all remove the #ifdefs around the U_BOOT_CMD as this file is only compiled when CONFIG_CMD_REGINFO is defined Signed-off-by: Christophe Leroy --- arch/powerpc/cpu/mpc85xx/cpu.c | 3 ++- arch/powerpc/cpu/mpc86xx/cpu.c | 3 ++- arch/powerpc/cpu/mpc8xx/reginfo.c | 3 ++- arch/powerpc/include/asm/ppc.h | 4 ++++ cmd/reginfo.c | 20 ++------------------ 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c index e3ef4ae816..b3de164bd8 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu.c +++ b/arch/powerpc/cpu/mpc85xx/cpu.c @@ -23,6 +23,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -384,7 +385,7 @@ int cpu_mmc_init(bd_t *bis) * Currently prints out LAWs, BR0/OR0 for LBC, CSPR/CSOR/Timing * parameters for IFC and TLBs */ -void mpc85xx_reginfo(void) +void print_reginfo(void) { print_tlbcam(); print_laws(); diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c index 7a9570c8ec..a02e872862 100644 --- a/arch/powerpc/cpu/mpc86xx/cpu.c +++ b/arch/powerpc/cpu/mpc86xx/cpu.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -160,7 +161,7 @@ watchdog_reset(void) * Print out the state of various machine registers. * Currently prints out LAWs, BR0/OR0, and BATs */ -void mpc86xx_reginfo(void) +void print_reginfo(void) { print_bats(); print_laws(); diff --git a/arch/powerpc/cpu/mpc8xx/reginfo.c b/arch/powerpc/cpu/mpc8xx/reginfo.c index 1ba4d22bdd..277d2753b2 100644 --- a/arch/powerpc/cpu/mpc8xx/reginfo.c +++ b/arch/powerpc/cpu/mpc8xx/reginfo.c @@ -8,8 +8,9 @@ #include #include #include +#include -void mpc8xx_reginfo(void) +void print_reginfo(void) { immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR; memctl8xx_t __iomem *memctl = &immap->im_memctl; diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h index 89f08eccc7..27d3b83e07 100644 --- a/arch/powerpc/include/asm/ppc.h +++ b/arch/powerpc/include/asm/ppc.h @@ -110,6 +110,10 @@ static inline void set_msr(unsigned long msr) asm volatile ("mtmsr %0" : : "r" (msr)); } +#ifdef CONFIG_CMD_REGINFO +void print_reginfo(void); +#endif + #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_PPC diff --git a/cmd/reginfo.c b/cmd/reginfo.c index b364cc899a..b23883e4bf 100644 --- a/cmd/reginfo.c +++ b/cmd/reginfo.c @@ -7,36 +7,20 @@ #include #include -#if defined(CONFIG_8xx) -void mpc8xx_reginfo(void); -#elif defined(CONFIG_MPC86xx) -extern void mpc86xx_reginfo(void); -#elif defined(CONFIG_MPC85xx) -extern void mpc85xx_reginfo(void); -#endif +#include static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { -#if defined(CONFIG_8xx) - mpc8xx_reginfo(); - -#elif defined(CONFIG_MPC86xx) - mpc86xx_reginfo(); - -#elif defined(CONFIG_MPC85xx) - mpc85xx_reginfo(); -#endif + print_reginfo(); return 0; } /**************************************************/ -#if defined(CONFIG_CMD_REGINFO) U_BOOT_CMD( reginfo, 2, 1, do_reginfo, "print register information", "" ); -#endif