[PATCH 1/2] board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD") init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because of this, the second ifdef within becomes pointless:
#if defined(CONFIG_SYS_I2C) static int init_func_i2c(void) <snip> #ifdef CONFIG_SYS_I2C ... #else ... #endif <snip> } #endif
Remove the dead #else preprocessor code.
Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD") Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com ---
common/board_f.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c index 3932e0c69d..d3444c7edc 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -254,11 +254,7 @@ __weak int dram_init_banksize(void) static int init_func_i2c(void) { puts("I2C: "); -#ifdef CONFIG_SYS_I2C i2c_init_all(); -#else - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); -#endif puts("ready\n"); return 0; }

The sections described in the sandbox linker script are inserted before data section via "INSERT BEFORE .data;". Running readelf -S on sandbox u-boot binary shows that the bss section is located after the data section:
Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [25] .u_boot_list PROGBITS 000000000041d1c8 0021d1c8 000000000000dd90 0000000000000000 WA 0 0 8 [26] _u_boot_sandbox_g PROGBITS 000000000042af58 0022af58 00000000000000a0 0000000000000000 WA 0 0 8 [27] .data PROGBITS 000000000042b000 0022b000 000000000000f708 0000000000000000 WA 0 0 32 [28] .bss NOBITS 000000000043a720 0023a708 0000000000018930 0000000000000000 WA 0 0 32
This means that the __bss_start assignment in the linker script is bogus, as the actual bss section start is located elsewhere. Remove this assignment, as the __bss_start symbol is not used on sandbox anyway.
Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com ---
arch/sandbox/cpu/u-boot-spl.lds | 2 -- arch/sandbox/cpu/u-boot.lds | 2 -- 2 files changed, 4 deletions(-)
diff --git a/arch/sandbox/cpu/u-boot-spl.lds b/arch/sandbox/cpu/u-boot-spl.lds index c60eb109b1..649abeb5ee 100644 --- a/arch/sandbox/cpu/u-boot-spl.lds +++ b/arch/sandbox/cpu/u-boot-spl.lds @@ -16,8 +16,6 @@ SECTIONS __u_boot_sandbox_option_start = .; _u_boot_sandbox_getopt : { KEEP(*(.u_boot_sandbox_getopt)) } __u_boot_sandbox_option_end = .; - - __bss_start = .; }
INSERT AFTER .data; diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds index 6a26c27e8e..936da5e140 100644 --- a/arch/sandbox/cpu/u-boot.lds +++ b/arch/sandbox/cpu/u-boot.lds @@ -44,8 +44,6 @@ SECTIONS { *(.__efi_runtime_rel_stop) } - - __bss_start = .; }
INSERT BEFORE .data;

On Mon, 17 Aug 2020 at 12:30, Ovidiu Panait ovidiu.panait@windriver.com wrote:
The sections described in the sandbox linker script are inserted before data section via "INSERT BEFORE .data;". Running readelf -S on sandbox u-boot binary shows that the bss section is located after the data section:
Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [25] .u_boot_list PROGBITS 000000000041d1c8 0021d1c8 000000000000dd90 0000000000000000 WA 0 0 8 [26] _u_boot_sandbox_g PROGBITS 000000000042af58 0022af58 00000000000000a0 0000000000000000 WA 0 0 8 [27] .data PROGBITS 000000000042b000 0022b000 000000000000f708 0000000000000000 WA 0 0 32 [28] .bss NOBITS 000000000043a720 0023a708 0000000000018930 0000000000000000 WA 0 0 32
This means that the __bss_start assignment in the linker script is bogus, as the actual bss section start is located elsewhere. Remove this assignment, as the __bss_start symbol is not used on sandbox anyway.
Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com
arch/sandbox/cpu/u-boot-spl.lds | 2 -- arch/sandbox/cpu/u-boot.lds | 2 -- 2 files changed, 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, 17 Aug 2020 at 12:30, Ovidiu Panait ovidiu.panait@windriver.com wrote:
The sections described in the sandbox linker script are inserted before data section via "INSERT BEFORE .data;". Running readelf -S on sandbox u-boot binary shows that the bss section is located after the data section:
Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [25] .u_boot_list PROGBITS 000000000041d1c8 0021d1c8 000000000000dd90 0000000000000000 WA 0 0 8 [26] _u_boot_sandbox_g PROGBITS 000000000042af58 0022af58 00000000000000a0 0000000000000000 WA 0 0 8 [27] .data PROGBITS 000000000042b000 0022b000 000000000000f708 0000000000000000 WA 0 0 32 [28] .bss NOBITS 000000000043a720 0023a708 0000000000018930 0000000000000000 WA 0 0 32
This means that the __bss_start assignment in the linker script is bogus, as the actual bss section start is located elsewhere. Remove this assignment, as the __bss_start symbol is not used on sandbox anyway.
Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com
arch/sandbox/cpu/u-boot-spl.lds | 2 -- arch/sandbox/cpu/u-boot.lds | 2 -- 2 files changed, 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!

On Mon, 17 Aug 2020 at 12:31, Ovidiu Panait ovidiu.panait@windriver.com wrote:
Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD") init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because of this, the second ifdef within becomes pointless:
#if defined(CONFIG_SYS_I2C) static int init_func_i2c(void)
<snip> #ifdef CONFIG_SYS_I2C ... #else ... #endif <snip> } #endif
Remove the dead #else preprocessor code.
Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD") Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com
common/board_f.c | 4 ---- 1 file changed, 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, 17 Aug 2020 at 12:31, Ovidiu Panait ovidiu.panait@windriver.com wrote:
Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD") init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because of this, the second ifdef within becomes pointless:
#if defined(CONFIG_SYS_I2C) static int init_func_i2c(void)
<snip> #ifdef CONFIG_SYS_I2C ... #else ... #endif <snip> } #endif
Remove the dead #else preprocessor code.
Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD") Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com
common/board_f.c | 4 ---- 1 file changed, 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!
participants (2)
-
Ovidiu Panait
-
Simon Glass