[coreboot-gerrit] New patch to review for coreboot: e3deeff drivers/spi: Excessive use of preprocessor checking Kconfig vars

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Wed Jul 2 07:18:56 CEST 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6171

-gerrit

commit e3deefff20ac079eab8b4e922b659a608c70e4e4
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Wed Jul 2 15:14:56 2014 +1000

    drivers/spi: Excessive use of preprocessor checking Kconfig vars
    
    printk(DEBUG, ..) will only show when DEBUG is selected, no need to wrap
    them again in another debug Kconfig variable.
    
    Change-Id: Id70dd55bf41c17931745996f5bad3d222f99ae6c
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/drivers/spi/adesto.c     | 4 ----
 src/drivers/spi/amic.c       | 4 ----
 src/drivers/spi/eon.c        | 4 ----
 src/drivers/spi/gigadevice.c | 4 ----
 src/drivers/spi/macronix.c   | 4 ----
 src/drivers/spi/spansion.c   | 4 ----
 src/drivers/spi/spi_flash.c  | 4 ----
 src/drivers/spi/sst.c        | 6 ------
 src/drivers/spi/stmicro.c    | 4 ----
 src/drivers/spi/winbond.c    | 4 ----
 10 files changed, 42 deletions(-)

diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c
index 83be8b8..79a267d 100644
--- a/src/drivers/spi/adesto.c
+++ b/src/drivers/spi/adesto.c
@@ -105,11 +105,9 @@ static int adesto_write(struct spi_flash *flash,
 		cmd[1] = (offset >> 16) & 0xff;
 		cmd[2] = (offset >> 8) & 0xff;
 		cmd[3] = offset & 0xff;
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		        " chunk_len = %zu\n", buf + actual,
 			cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_AT25DF_WREN, NULL, 0);
 		if (ret < 0) {
@@ -132,10 +130,8 @@ static int adesto_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: adesto: Successfully programmed %zu bytes @"
 			" 0x%lx\n", len, (unsigned long)(offset - len));
-#endif
 	ret = 0;
 
 out:
diff --git a/src/drivers/spi/amic.c b/src/drivers/spi/amic.c
index fa17036..f675a30 100644
--- a/src/drivers/spi/amic.c
+++ b/src/drivers/spi/amic.c
@@ -87,11 +87,9 @@ static int amic_write(struct spi_flash *flash,
 		cmd[1] = (offset >> 16) & 0xff;
 		cmd[2] = (offset >> 8) & 0xff;
 		cmd[3] = offset & 0xff;
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		        " chunk_len = %zu\n", buf + actual,
 			cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_A25_WREN, NULL, 0);
 		if (ret < 0) {
@@ -114,10 +112,8 @@ static int amic_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: AMIC: Successfully programmed %zu bytes @"
 			" 0x%lx\n", len, (unsigned long)(offset - len));
-#endif
 	ret = 0;
 
 out:
diff --git a/src/drivers/spi/eon.c b/src/drivers/spi/eon.c
index 5a74b84..7cd92b8 100644
--- a/src/drivers/spi/eon.c
+++ b/src/drivers/spi/eon.c
@@ -95,11 +95,9 @@ static int eon_write(struct spi_flash *flash,
 		cmd[2] = page_addr;
 		cmd[3] = byte_addr;
 
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW,
 		    "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %zu\n",
 		     buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_EN25Q128_WREN, NULL, 0);
 		if (ret < 0) {
@@ -122,10 +120,8 @@ static int eon_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: EON: Successfully programmed %zu bytes @ 0x%x\n",
 	      len, offset);
-#endif
 
 	spi_release_bus(flash->spi);
 	return ret;
diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c
index 5a8f82f..1f3ef69 100644
--- a/src/drivers/spi/gigadevice.c
+++ b/src/drivers/spi/gigadevice.c
@@ -153,12 +153,10 @@ static int gigadevice_write(struct spi_flash *flash, u32 offset,
 		cmd[1] = (offset >> 16) & 0xff;
 		cmd[2] = (offset >> 8) & 0xff;
 		cmd[3] = offset & 0xff;
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW,
 		       "PP gigadevice.c: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		       " chunk_len = %zu\n", buf + actual,
 		       cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
 					  buf + actual, chunk_len);
@@ -176,11 +174,9 @@ static int gigadevice_write(struct spi_flash *flash, u32 offset,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW,
 	       "SF gigadevice.c: Successfully programmed %zu bytes @ %#x\n",
 	       len, (unsigned int)(offset - len));
-#endif
 
 	ret = 0;
 
diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c
index bbc3704..104096e 100644
--- a/src/drivers/spi/macronix.c
+++ b/src/drivers/spi/macronix.c
@@ -150,11 +150,9 @@ static int macronix_write(struct spi_flash *flash,
 		cmd[2] = (offset >> 8) & 0xff;
 		cmd[3] = offset & 0xff;
 
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		     " chunk_len = %zu\n",
 		     buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_MX25XX_WREN, NULL, 0);
 		if (ret < 0) {
@@ -177,10 +175,8 @@ static int macronix_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: Macronix: Successfully programmed %zu bytes @"
 	      " 0x%lx\n", len, (unsigned long)(offset - len));
-#endif
 
 	spi_release_bus(flash->spi);
 	return ret;
diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c
index 6dd6df9..f0ee4c3 100644
--- a/src/drivers/spi/spansion.c
+++ b/src/drivers/spi/spansion.c
@@ -163,11 +163,9 @@ static int spansion_write(struct spi_flash *flash,
 		cmd[2] = page_addr;
 		cmd[3] = byte_addr;
 
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		     " chunk_len = %zu\n",
 		     buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_S25FLXX_WREN, NULL, 0);
 		if (ret < 0) {
@@ -190,10 +188,8 @@ static int spansion_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: SPANSION: Successfully programmed %zu bytes @ 0x%x\n",
 	      len, offset);
-#endif
 
 	spi_release_bus(flash->spi);
 	return ret;
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index 33588d5..38a1949 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -164,10 +164,8 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u8 erase_cmd,
 		spi_flash_addr(offset, cmd);
 		offset += erase_size;
 
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x (%x)\n", cmd[0], cmd[1],
 		      cmd[2], cmd[3], offset);
-#endif
 		ret = spi_flash_cmd(flash->spi, CMD_WRITE_ENABLE, NULL, 0);
 		if (ret)
 			goto out;
@@ -285,9 +283,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 	if (ret)
 		goto err_read_id;
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: Got idcodes\n");
-#endif
 
 	/* count the number of continuation bytes */
 	for (shift = 0, idp = idcode;
diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c
index 3cf6c50..3be6f05 100644
--- a/src/drivers/spi/sst.c
+++ b/src/drivers/spi/sst.c
@@ -125,10 +125,8 @@ sst_byte_write(struct spi_flash *flash, u32 offset, const void *buf)
 		offset,
 	};
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "BP[%02x]: 0x%p => cmd = { 0x%02x 0x%06x }\n",
 		spi_w8r8(flash->spi, CMD_SST_RDSR), buf, cmd[0], offset);
-#endif
 
 	ret = sst_enable_writing(flash);
 	if (ret)
@@ -175,11 +173,9 @@ sst_write(struct spi_flash *flash, u32 offset, size_t len, const void *buf)
 	cmd[3] = offset;
 
 	for (; actual < len - 1; actual += 2) {
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "WP[%02x]: 0x%p => cmd = { 0x%02x 0x%06x }\n",
 		     spi_w8r8(flash->spi, CMD_SST_RDSR), buf + actual, cmd[0],
 		     offset);
-#endif
 
 		ret = spi_flash_cmd_write(flash->spi, cmd, cmd_len,
 		                          buf + actual, 2);
@@ -204,10 +200,8 @@ sst_write(struct spi_flash *flash, u32 offset, size_t len, const void *buf)
 		ret = sst_byte_write(flash, offset, buf + actual);
 
 done:
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: SST: program %s %zu bytes @ 0x%lx\n",
 	      ret ? "failure" : "success", len, (unsigned long)offset - actual);
-#endif
 	spi_release_bus(flash->spi);
 	return ret;
 }
diff --git a/src/drivers/spi/stmicro.c b/src/drivers/spi/stmicro.c
index af23853..9bca343 100644
--- a/src/drivers/spi/stmicro.c
+++ b/src/drivers/spi/stmicro.c
@@ -160,11 +160,9 @@ static int stmicro_write(struct spi_flash *flash,
 		cmd[1] = (offset >> 16) & 0xff;
 		cmd[2] = (offset >> 8) & 0xff;
 		cmd[3] = offset & 0xff;
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		     " chunk_len = %zu\n",
 		     buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_M25PXX_WREN, NULL, 0);
 		if (ret < 0) {
@@ -187,10 +185,8 @@ static int stmicro_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: STMicro: Successfully programmed %zu bytes @"
 			" 0x%lx\n", len, (unsigned long)(offset - len));
-#endif
 	ret = 0;
 
 out:
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 52c7b61..9df7cfd 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -139,11 +139,9 @@ static int winbond_write(struct spi_flash *flash,
 		cmd[1] = (offset >> 16) & 0xff;
 		cmd[2] = (offset >> 8) & 0xff;
 		cmd[3] = offset & 0xff;
-#if CONFIG_DEBUG_SPI_FLASH
 		printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
 		        " chunk_len = %zu\n", buf + actual,
 			cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
-#endif
 
 		ret = spi_flash_cmd(flash->spi, CMD_W25_WREN, NULL, 0);
 		if (ret < 0) {
@@ -166,10 +164,8 @@ static int winbond_write(struct spi_flash *flash,
 		byte_addr = 0;
 	}
 
-#if CONFIG_DEBUG_SPI_FLASH
 	printk(BIOS_SPEW, "SF: Winbond: Successfully programmed %zu bytes @"
 			" 0x%lx\n", len, (unsigned long)(offset - len));
-#endif
 	ret = 0;
 
 out:



More information about the coreboot-gerrit mailing list