]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined
authorStefan Roese <sr@denx.de>
Wed, 12 Aug 2020 09:55:46 +0000 (11:55 +0200)
committerStefan Roese <sr@denx.de>
Wed, 26 Aug 2020 07:19:16 +0000 (09:19 +0200)
Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/broadwell/cpu_from_spl.c
board/xilinx/zynqmp/zynqmp.c
cmd/bdinfo.c
common/board_f.c
common/image.c
common/init/handoff.c
drivers/pci/pci-uclass.c
include/asm-generic/u-boot.h
include/handoff.h
lib/fdtdec.c
lib/lmb.c

index 6567d506533fb7accc5ff20890af218a59473e0f..4d4cdafa2b0aebf3d0796577535d42b57bf038c9 100644 (file)
@@ -53,14 +53,12 @@ void board_debug_uart_init(void)
 
 int dram_init_banksize(void)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
        struct spl_handoff *ho;
 
        ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(*ho));
        if (!ho)
                return log_msg_ret("Missing SPL hand-off info", -ENOENT);
        handoff_load_dram_banks(ho);
-#endif
 
        return 0;
 }
index b4e7301d50947cd8be8bc815c00ffbb0e5b28bd0..bcfd56a91287ee2f73ab8453c9e3b2e84b429321 100644 (file)
@@ -423,10 +423,8 @@ int dram_init(void)
 #else
 int dram_init_banksize(void)
 {
-#if defined(CONFIG_NR_DRAM_BANKS)
        gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
        gd->bd->bi_dram[0].size = get_effective_memsize();
-#endif
 
        mem_map_fill();
 
index 9593b345a3d72fe76e233ab2a9232d3df694579b..9e230f23cbb16b902760711a89c15d7331cbab33 100644 (file)
@@ -49,7 +49,6 @@ void bdinfo_print_mhz(const char *name, unsigned long hz)
 
 static void print_bi_dram(const struct bd_info *bd)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
        int i;
 
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
@@ -59,7 +58,6 @@ static void print_bi_dram(const struct bd_info *bd)
                        bdinfo_print_num("-> size",     bd->bi_dram[i].size);
                }
        }
-#endif
 }
 
 __weak void arch_print_bdinfo(void)
index d3444c7edc93c4781f40f36755bcf81b46600e9b..ed37e3acaaf98987bfa5e39adbf54d6a3f46906f 100644 (file)
@@ -215,8 +215,6 @@ static int announce_dram_init(void)
 static int show_dram_config(void)
 {
        unsigned long long size;
-
-#ifdef CONFIG_NR_DRAM_BANKS
        int i;
 
        debug("\nRAM Configuration:\n");
@@ -229,9 +227,6 @@ static int show_dram_config(void)
 #endif
        }
        debug("\nDRAM:  ");
-#else
-       size = gd->ram_size;
-#endif
 
        print_size(size, "");
        board_add_ram_info(0);
@@ -242,7 +237,7 @@ static int show_dram_config(void)
 
 __weak int dram_init_banksize(void)
 {
-#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
+#if defined(CONFIG_SYS_SDRAM_BASE)
        gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
        gd->bd->bi_dram[0].size = get_effective_memsize();
 #endif
index 9d7d5c17d1220514e82b487153c53de66fa089b8..2ed46f7685194fbaeae75f134a8638604832d113 100644 (file)
@@ -685,8 +685,7 @@ phys_size_t env_get_bootm_size(void)
                return tmp;
        }
 
-#if (defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)) && \
-     defined(CONFIG_NR_DRAM_BANKS)
+#if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)
        start = gd->bd->bi_dram[0].start;
        size = gd->bd->bi_dram[0].size;
 #else
index e00b43e6a7bcdef233b25c4837a0f3e40ab6ed2b..62071bd0179d3ff1454875f5d3814d212bcc7ed8 100644 (file)
@@ -12,18 +12,15 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void handoff_save_dram(struct spl_handoff *ho)
 {
+       struct bd_info *bd = gd->bd;
+       int i;
+
        ho->ram_size = gd->ram_size;
-#ifdef CONFIG_NR_DRAM_BANKS
-       {
-               struct bd_info *bd = gd->bd;
-               int i;
-
-               for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-                       ho->ram_bank[i].start = bd->bi_dram[i].start;
-                       ho->ram_bank[i].size = bd->bi_dram[i].size;
-               }
+
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+               ho->ram_bank[i].start = bd->bi_dram[i].start;
+               ho->ram_bank[i].size = bd->bi_dram[i].size;
        }
-#endif
 }
 
 void handoff_load_dram_size(struct spl_handoff *ho)
@@ -33,15 +30,11 @@ void handoff_load_dram_size(struct spl_handoff *ho)
 
 void handoff_load_dram_banks(struct spl_handoff *ho)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
-       {
-               struct bd_info *bd = gd->bd;
-               int i;
-
-               for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-                       bd->bi_dram[i].start = ho->ram_bank[i].start;
-                       bd->bi_dram[i].size = ho->ram_bank[i].size;
-               }
+       struct bd_info *bd = gd->bd;
+       int i;
+
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+               bd->bi_dram[i].start = ho->ram_bank[i].start;
+               bd->bi_dram[i].size = ho->ram_bank[i].size;
        }
-#endif
 }
index d8a6647a1da9c47a1e24f46ffc12bd14125189c7..eb07d253011d4f0959d9714da5f9a4da79425b1b 100644 (file)
@@ -911,8 +911,8 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
                           ofnode node)
 {
        int pci_addr_cells, addr_cells, size_cells;
-       struct bd_info *bd = gd->bd;
        int cells_per_record;
+       struct bd_info *bd;
        const u32 *prop;
        int max_regions;
        int len;
@@ -989,6 +989,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
        }
 
        /* Add a region for our local memory */
+       bd = gd->bd;
        if (!bd)
                return;
 
index 62e61d41cc9c66841d42a2ab5a2aab1268cdbbbd..99d3fe33ad9f808d81b361c5a3a8e0c72be69bd9 100644 (file)
@@ -70,12 +70,10 @@ struct bd_info {
 #endif
        ulong           bi_arch_number; /* unique id for this board */
        ulong           bi_boot_params; /* where this board expects params */
-#ifdef CONFIG_NR_DRAM_BANKS
        struct {                        /* RAM configuration */
                phys_addr_t start;
                phys_size_t size;
        } bi_dram[CONFIG_NR_DRAM_BANKS];
-#endif /* CONFIG_NR_DRAM_BANKS */
 };
 
 #endif /* __ASSEMBLY__ */
index 75d19b1f6e511174cf48eac30b8d0dd8e6914c3d..070a79c1b97e9a27d1ec505f12e1a08ab98e9608 100644 (file)
 struct spl_handoff {
        struct arch_spl_handoff arch;
        u64 ram_size;
-#ifdef CONFIG_NR_DRAM_BANKS
        struct {
                u64 start;
                u64 size;
        } ram_bank[CONFIG_NR_DRAM_BANKS];
-#endif
 };
 
 void handoff_save_dram(struct spl_handoff *ho);
index d3b22ec3238083f082f396e26d4e927e616cc521..1ef976ee268665191e7116463db9235b4133d5ed 100644 (file)
@@ -1073,8 +1073,6 @@ int fdtdec_setup_mem_size_base(void)
        return 0;
 }
 
-#if defined(CONFIG_NR_DRAM_BANKS)
-
 ofnode get_next_memory_node(ofnode mem)
 {
        do {
@@ -1170,7 +1168,6 @@ int fdtdec_setup_mem_size_base_lowest(void)
 
        return 0;
 }
-#endif
 
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\
@@ -1633,7 +1630,6 @@ int fdtdec_resetup(int *rescan)
 }
 #endif
 
-#ifdef CONFIG_NR_DRAM_BANKS
 int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
                           phys_addr_t *basep, phys_size_t *sizep,
                           struct bd_info *bd)
@@ -1739,6 +1735,5 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
 
        return 0;
 }
-#endif /* CONFIG_NR_DRAM_BANKS */
 
 #endif /* !USE_HOSTCC */
index 75082f35599b6131984d655d4e2b017ef49128b9..d126f8dc04a1d5e640ec3f5b6a52521e8feb7fa5 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -117,22 +117,17 @@ static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
 /* Initialize the struct, add memory and call arch/board reserve functions */
 void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob)
 {
-#ifdef CONFIG_NR_DRAM_BANKS
        int i;
-#endif
 
        lmb_init(lmb);
-#ifdef CONFIG_NR_DRAM_BANKS
+
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
                if (bd->bi_dram[i].size) {
                        lmb_add(lmb, bd->bi_dram[i].start,
                                bd->bi_dram[i].size);
                }
        }
-#else
-       if (bd->bi_memsize)
-               lmb_add(lmb, bd->bi_memstart, bd->bi_memsize);
-#endif
+
        lmb_reserve_common(lmb, fdt_blob);
 }