[flashrom] [PATCH] print*.c: Refine the do not count nor print generic flash chip entries.

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Tue Jan 31 06:51:01 CET 2012


Previously only the generic "unknown XXXX SPI chips" were ignored (because their
name started with "unknown".
This patch adds also all chips whose vendor starts with "Unknown" (none so far).
Change the vendor of the entry for the opaque programmer framework to
"Unknown" to ignore it.
Another patch will add the SFDP chip template also with an "Unknown" vendor field.

Rationale: these entries do not contain any useful information when shown in -L
or wiki output. It would be better to add them to a general feature section or similar.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
 flashchips.c |    2 +-
 print.c      |   10 ++++++----
 print_wiki.c |   11 ++++++-----
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/flashchips.c b/flashchips.c
index ca1c57f..0c8257b 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -8874,7 +8874,7 @@ const struct flashchip flashchips[] = {
 	},
 
 	{
-		.vendor		= "Programmer",
+		.vendor		= "Unknown",
 		.name		= "Opaque flash chip",
 		.bustype	= BUS_PROG,
 		.manufacture_id	= PROGMANUF_ID,
diff --git a/print.c b/print.c
index 0e152a6..ba86ebb 100644
--- a/print.c
+++ b/print.c
@@ -74,8 +74,9 @@ static void print_supported_chips(void)
 
 	/* calculate maximum column widths and by iterating over all chips */
 	for (f = flashchips; f->name != NULL; f++) {
-		/* Ignore "unknown XXXX SPI chip" entries. */
-		if (!strncmp(f->name, "unknown", 7))
+		/* Ignore generic entries. */
+		if (!strncmp(f->vendor, "Unknown", 7) ||
+		    !strncmp(f->name, "unknown", 7))
 			continue;
 		chipcount++;
 
@@ -161,8 +162,9 @@ static void print_supported_chips(void)
 	msg_ginfo("(P = PROBE, R = READ, E = ERASE, W = WRITE)\n\n");
 
 	for (f = flashchips; f->name != NULL; f++) {
-		/* Don't print "unknown XXXX SPI chip" entries. */
-		if (!strncmp(f->name, "unknown", 7))
+		/* Don't print generic entries. */
+		if (!strncmp(f->vendor, "Unknown", 7) ||
+		    !strncmp(f->name, "unknown", 7))
 			continue;
 
 		/* support for multiline vendor names:
diff --git a/print_wiki.c b/print_wiki.c
index 1c9241e..70f4427 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -216,9 +216,9 @@ static void print_supported_chips_wiki(int cols)
 	char vmin[6];
 
 	for (f = flashchips; f->name != NULL; f++) {
-		/* Don't count "unknown XXXX SPI chip" entries. */
-		if (!strncmp(f->name, "unknown", 7))
-			continue;
+		/* Don't count generic entries. */
+		if (!strncmp(f->vendor, "Unknown", 7) ||
+		    !strncmp(f->name, "unknown", 7))
 		chipcount++;
 	}
 
@@ -227,8 +227,9 @@ static void print_supported_chips_wiki(int cols)
 		"| valign=\"top\"|\n\n%s", chipcount, chip_th);
 
 	for (f = flashchips; f->name != NULL; f++, i++) {
-		/* Don't print "unknown XXXX SPI chip" entries. */
-		if (!strncmp(f->name, "unknown", 7))
+		/* Don't print generic entries. */
+		if (!strncmp(f->vendor, "Unknown", 7) ||
+		    !strncmp(f->name, "unknown", 7))
 			continue;
 
 		/* Alternate colors if the vendor changes. */
-- 
1.7.1





More information about the flashrom mailing list