From 3b5d9ee516adb42a57557a8712761ad94633a276 Mon Sep 17 00:00:00 2001 From: Fred Reitberger Date: Thu, 23 Mar 2023 14:35:39 -0400 Subject: 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 Change-Id: I7af747812a448064ac6b38686b8bd616a755932e Reviewed-on: https://review.coreboot.org/c/coreboot/+/73970 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Felix Singer Reviewed-by: Angel Pons Reviewed-by: Martin L Roth --- src/drivers/spi/spi_flash.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/drivers') 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; -- cgit v1.2.3