Skip to contentSkip to conversation

sf: move useful messages from debug to printf

PATCH Superseded Mike Frysinger 2 participants 3 messages Apr 29, 2010 – Apr 30, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sf: move useful messages from debug to printf

At the moment, the default SPI flash subsystem is quite terse. Errors and successes both result in a generic message. So move the useful errors and useful successes to printf output by default.

---
 drivers/mtd/spi/atmel.c     |    2 +-
 drivers/mtd/spi/spansion.c  |    4 ++--
 drivers/mtd/spi/spi_flash.c |    4 ++--
 drivers/mtd/spi/sst.c       |    4 ++--
 drivers/mtd/spi/stmicro.c   |    4 ++--
 drivers/mtd/spi/winbond.c   |    4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)
drivers/mtd/spi/atmel.c +1 -1
index 8306c00..f1f5975 100644
@@ -540,7 +540,7 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 				* params->blocks_per_sector
 				* params->nr_sectors;
 
-	debug("SF: Detected %s with page size %lu, total %u bytes\n",
+	printf("SF: Detected %s with page size %lu, total %u bytes\n",
 			params->name, page_size, asf->flash.size);
 
 	return &asf->flash;
drivers/mtd/spi/spansion.c +2 -2
index fdb7917..cd1f250 100644
@@ -343,8 +343,8 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
 	spsn->flash.size = params->page_size * params->pages_per_sector
 	    * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, spsn->flash.size);
+	printf("SF: Detected %s with page size %u, total %u bytes\n",
+	       params->name, params->page_size, spsn->flash.size);
 
 	return &spsn->flash;
 }
drivers/mtd/spi/spi_flash.c +2 -2
index 612f819..bbb194e 100644
@@ -106,7 +106,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 
 	spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
 	if (!spi) {
-		debug("SF: Failed to set up slave\n");
+		printf("SF: Failed to set up slave\n");
 		return NULL;
 	}
 
@@ -156,7 +156,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		break;
 #endif
 	default:
-		debug("SF: Unsupported manufacturer %02X\n", idcode[0]);
+		printf("SF: Unsupported manufacturer %02X\n", idcode[0]);
 		flash = NULL;
 		break;
 	}
drivers/mtd/spi/sst.c +2 -2
index 50e9299..9d5ebef 100644
@@ -364,8 +364,8 @@ spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode)
 	stm->flash.read = sst_read_fast;
 	stm->flash.size = SST_SECTOR_SIZE * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, SST_SECTOR_SIZE, stm->flash.size);
+	printf("SF: Detected %s with page size %u, total %u bytes\n",
+	       params->name, SST_SECTOR_SIZE, stm->flash.size);
 
 	/* Flash powers up read-only, so clear BP# bits */
 	sst_unlock(&stm->flash);
drivers/mtd/spi/stmicro.c +2 -2
index ae0d047..9b17b3e 100644
@@ -344,8 +344,8 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
 	stm->flash.size = params->page_size * params->pages_per_sector
 	    * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, stm->flash.size);
+	printf("SF: Detected %s with page size %u, total %u bytes\n",
+	       params->name, params->page_size, stm->flash.size);
 
 	return &stm->flash;
 }
drivers/mtd/spi/winbond.c +2 -2
index b8da923..09c4f1a 100644
@@ -289,7 +289,7 @@ out:
 struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
 {
 	const struct winbond_spi_flash_params *params;
-	unsigned long page_size;
+	unsigned page_size;
 	struct winbond_spi_flash *stm;
 	unsigned int i;
 
@@ -325,7 +325,7 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
 				* params->sectors_per_block
 				* params->nr_blocks;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
+	printf("SF: Detected %s with page size %u, total %u bytes\n",
 			params->name, page_size, stm->flash.size);
 
 	return &stm->flash;
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 sf: move useful messages from debug to printf

Dear Mike Frysinger,

Quoted 3 lines · In message <[email protected]> you wrote:

At the moment, the default SPI flash subsystem is quite terse. Errors and successes both result in a generic message. So move the useful errors and useful successes to printf output by default.

...

drivers/mtd/spi/atmel.c struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode) · line 544

Quoted 3 lines
drivers/mtd/spi/atmel.c +1 -1
-	debug("SF: Detected %s with page size %lu, total %u bytes\n",
+	printf("SF: Detected %s with page size %lu, total %u bytes\n",
 			params->name, page_size, asf->flash.size);

When we touch this code, we might as well make the output more readable and print the size in easier to parse units using print_size() - see Timur's patches from 13 Ap 2010,
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/77288

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is your destiny.                                     - Darth Vader
#2 lore raw

PATCH v2 1/1 sf: move useful messages from debug to printf

At the moment, the default SPI flash subsystem is quite terse. Errors and successes both result in a generic message. So move the useful errors and useful successes to printf output by default.

While we're here, also convert the messages to use print_size().

---
v2
- use print_size() per Wolfgang

 drivers/mtd/spi/atmel.c     |    7 ++++---
 drivers/mtd/spi/macronix.c  |    5 +++--
 drivers/mtd/spi/spansion.c  |    5 +++--
 drivers/mtd/spi/spi_flash.c |    4 ++--
 drivers/mtd/spi/sst.c       |    5 +++--
 drivers/mtd/spi/stmicro.c   |    5 +++--
 drivers/mtd/spi/winbond.c   |    7 ++++---
 7 files changed, 22 insertions(+), 16 deletions(-)
drivers/mtd/spi/atmel.c +4 -3
index 8306c00..8d02169 100644
@@ -467,7 +467,7 @@ out:
 struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 {
 	const struct atmel_spi_flash_params *params;
-	unsigned long page_size;
+	unsigned page_size;
 	unsigned int family;
 	struct atmel_spi_flash *asf;
 	unsigned int i;
@@ -540,8 +540,9 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 				* params->blocks_per_sector
 				* params->nr_sectors;
 
-	debug("SF: Detected %s with page size %lu, total %u bytes\n",
-			params->name, page_size, asf->flash.size);
+	printf("SF: Detected %s with page size %u, total ",
+	       params->name, page_size);
+	print_size(asf->flash.size, "\n");
 
 	return &asf->flash;
 
drivers/mtd/spi/macronix.c +3 -2
index fe1310b..76d5284 100644
@@ -330,8 +330,9 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 	mcx->flash.size = params->page_size * params->pages_per_sector
 	    * params->sectors_per_block * params->nr_blocks;
 
-	printf("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, mcx->flash.size);
+	printf("SF: Detected %s with page size %u, total ",
+	       params->name, params->page_size);
+	print_size(mcx->flash.size, "\n");
 
 	return &mcx->flash;
 }
drivers/mtd/spi/spansion.c +3 -2
index fdb7917..d6c1a5f 100644
@@ -343,8 +343,9 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
 	spsn->flash.size = params->page_size * params->pages_per_sector
 	    * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, spsn->flash.size);
+	printf("SF: Detected %s with page size %u, total ",
+	       params->name, params->page_size);
+	print_size(spsn->flash.size, "\n");
 
 	return &spsn->flash;
 }
drivers/mtd/spi/spi_flash.c +2 -2
index 612f819..bbb194e 100644
@@ -106,7 +106,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 
 	spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
 	if (!spi) {
-		debug("SF: Failed to set up slave\n");
+		printf("SF: Failed to set up slave\n");
 		return NULL;
 	}
 
@@ -156,7 +156,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		break;
 #endif
 	default:
-		debug("SF: Unsupported manufacturer %02X\n", idcode[0]);
+		printf("SF: Unsupported manufacturer %02X\n", idcode[0]);
 		flash = NULL;
 		break;
 	}
drivers/mtd/spi/sst.c +3 -2
index 50e9299..2557891 100644
@@ -364,8 +364,9 @@ spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode)
 	stm->flash.read = sst_read_fast;
 	stm->flash.size = SST_SECTOR_SIZE * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, SST_SECTOR_SIZE, stm->flash.size);
+	printf("SF: Detected %s with page size %u, total ",
+	       params->name, SST_SECTOR_SIZE);
+	print_size(stm->flash.size, "\n");
 
 	/* Flash powers up read-only, so clear BP# bits */
 	sst_unlock(&stm->flash);
drivers/mtd/spi/stmicro.c +3 -2
index ae0d047..6c52f6a 100644
@@ -344,8 +344,9 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
 	stm->flash.size = params->page_size * params->pages_per_sector
 	    * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, stm->flash.size);
+	printf("SF: Detected %s with page size %u, total ",
+	       params->name, params->page_size);
+	print_size(stm->flash.size, "\n");
 
 	return &stm->flash;
 }
drivers/mtd/spi/winbond.c +4 -3
index b8da923..ff1df25 100644
@@ -289,7 +289,7 @@ out:
 struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
 {
 	const struct winbond_spi_flash_params *params;
-	unsigned long page_size;
+	unsigned page_size;
 	struct winbond_spi_flash *stm;
 	unsigned int i;
 
@@ -325,8 +325,9 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
 				* params->sectors_per_block
 				* params->nr_blocks;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-			params->name, page_size, stm->flash.size);
+	printf("SF: Detected %s with page size %u, total ",
+	       params->name, page_size);
+	print_size(stm->flash.size, "\n");
 
 	return &stm->flash;
 }
Signature · 1 line
1.7.0.4