diff options
author | Fred Reitberger <reitbergerfred@gmail.com> | 2023-03-23 14:35:39 -0400 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2023-03-26 21:02:35 +0000 |
commit | 3b5d9ee516adb42a57557a8712761ad94633a276 (patch) | |
tree | c4824806814ec27b9477228c935a1ce6c55796c3 /src/drivers/spi | |
parent | 13ed70f10be413f317126dc5f0b3b541eeacc116 (diff) |
drivers/spi/spi_flash.c: Prefer 'if' over '#if"
Change preprocessor #if to a regular if and let the compiler optimize
away the unused branch.
Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com>
Change-Id: I7af747812a448064ac6b38686b8bd616a755932e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73970
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Diffstat (limited to 'src/drivers/spi')
-rw-r--r-- | src/drivers/spi/spi_flash.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index a7908ca7e5..ea1b7162d2 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -262,14 +262,15 @@ int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len) spi_flash_addr(offset, cmd); offset += erase_size; -#if CONFIG(DEBUG_SPI_FLASH) - if (ADDR_MOD) - printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x %2x (%x)\n", - cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], offset); - else - printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x (%x)\n", - cmd[0], cmd[1], cmd[2], cmd[3], offset); -#endif + if (CONFIG(DEBUG_SPI_FLASH)) { + if (ADDR_MOD) + printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x %2x (%x)\n", + cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], offset); + else + printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x (%x)\n", + cmd[0], cmd[1], cmd[2], cmd[3], offset); + } + ret = spi_flash_cmd(&flash->spi, CMD_WRITE_ENABLE, NULL, 0); if (ret) goto out; |