Verbose probe output is split across multiple lines for some probe functions
This makes visual inspection and grepping a lot harder than necessary.
Remove line breaks where appropriate. Some error messages should end up
on stderr instead of just being displayed in verbose mode.
Thanks to Maciej Pijanka for testing.
Corresponding to flashrom svn r660.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
diff --git a/spi.c b/spi.c
index 09cfc90..8d82c4e 100644
--- a/spi.c
+++ b/spi.c
@@ -163,7 +163,7 @@
printf_debug("RDID returned");
for (i = 0; i < bytes; i++)
printf_debug(" 0x%02x", readarr[i]);
- printf_debug("\n");
+ printf_debug(". ");
return 0;
}
@@ -184,7 +184,7 @@
}
if (ret)
return ret;
- printf_debug("REMS returned %02x %02x.\n", readarr[0], readarr[1]);
+ printf_debug("REMS returned %02x %02x. ", readarr[0], readarr[1]);
return 0;
}
@@ -205,7 +205,7 @@
}
if (ret)
return ret;
- printf_debug("RES returned %02x.\n", readarr[0]);
+ printf_debug("RES returned %02x. ", readarr[0]);
return 0;
}
@@ -218,7 +218,7 @@
result = spi_send_command(sizeof(cmd), 0, cmd, NULL);
if (result)
- printf_debug("%s failed\n", __func__);
+ fprintf(stderr, "%s failed\n", __func__);
return result;
}
@@ -241,12 +241,12 @@
return 0;
if (!oddparity(readarr[0]))
- printf_debug("RDID byte 0 parity violation.\n");
+ printf_debug("RDID byte 0 parity violation. ");
/* Check if this is a continuation vendor ID */
if (readarr[0] == 0x7f) {
if (!oddparity(readarr[1]))
- printf_debug("RDID byte 1 parity violation.\n");
+ printf_debug("RDID byte 1 parity violation. ");
id1 = (readarr[0] << 8) | readarr[1];
id2 = readarr[2];
if (bytes > 3) {
@@ -373,7 +373,7 @@
}
ret = spi_send_command(sizeof(cmd), sizeof(readarr), cmd, readarr);
if (ret)
- printf_debug("RDSR failed!\n");
+ fprintf(stderr, "RDSR failed!\n");
return readarr[0];
}
@@ -506,13 +506,14 @@
result = spi_disable_blockprotect();
if (result) {
- printf_debug("spi_disable_blockprotect failed\n");
+ fprintf(stderr, "spi_disable_blockprotect failed\n");
return result;
}
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n",
+ __func__);
return result;
}
/* Wait until the Write-In-Progress bit is cleared.
@@ -551,13 +552,13 @@
result = spi_disable_blockprotect();
if (result) {
- printf_debug("spi_disable_blockprotect failed\n");
+ fprintf(stderr, "spi_disable_blockprotect failed\n");
return result;
}
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n", __func__);
return result;
}
/* Wait until the Write-In-Progress bit is cleared.
@@ -607,7 +608,8 @@
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n",
+ __func__);
return result;
}
/* Wait until the Write-In-Progress bit is cleared.
@@ -650,7 +652,7 @@
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n", __func__);
return result;
}
/* Wait until the Write-In-Progress bit is cleared.
@@ -678,7 +680,7 @@
for (i = 0; i < total_size / erase_size; i++) {
rc = spi_block_erase_d8(flash, i * erase_size, erase_size);
if (rc) {
- printf("Error erasing block at 0x%x\n", i);
+ fprintf(stderr, "Error erasing block at 0x%x\n", i);
break;
}
}
@@ -712,7 +714,8 @@
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n",
+ __func__);
return result;
}
/* Wait until the Write-In-Progress bit is cleared.
@@ -730,7 +733,8 @@
int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
{
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n", __func__);
+ fprintf(stderr, "%s called with incorrect arguments\n",
+ __func__);
return -1;
}
return spi_chip_erase_60(flash);
@@ -739,7 +743,8 @@
int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
{
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
- fprintf(stderr, "%s called with incorrect arguments\n", __func__);
+ fprintf(stderr, "%s called with incorrect arguments\n",
+ __func__);
return -1;
}
return spi_chip_erase_c7(flash);
@@ -754,7 +759,7 @@
result = spi_send_command(sizeof(cmd), JEDEC_EWSR_INSIZE, cmd, NULL);
if (result)
- printf_debug("%s failed\n", __func__);
+ fprintf(stderr, "%s failed\n", __func__);
return result;
}
@@ -786,7 +791,8 @@
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n",
+ __func__);
}
return result;
}
@@ -814,7 +820,8 @@
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n",
+ __func__);
}
return result;
}
@@ -848,11 +855,11 @@
}};
if (!len) {
- printf_debug ("%s called for zero-length write\n", __func__);
+ fprintf(stderr, "%s called for zero-length write\n", __func__);
return 1;
}
if (len > 256) {
- printf_debug ("%s called for too long a write\n", __func__);
+ fprintf(stderr, "%s called for too long a write\n", __func__);
return 1;
}
@@ -860,7 +867,8 @@
result = spi_send_multicommand(spicommands);
if (result) {
- printf_debug("%s failed during command execution\n", __func__);
+ fprintf(stderr, "%s failed during command execution\n",
+ __func__);
}
return result;
}
@@ -876,7 +884,7 @@
printf_debug("Some block protection in effect, disabling\n");
result = spi_write_status_register(status & ~0x3c);
if (result) {
- printf_debug("spi_write_status_register failed\n");
+ fprintf(stderr, "spi_write_status_register failed\n");
return result;
}
}