Hi,
This patch change the chipnames in flashchips.c to use bash style brace expansion syntax for chip IDs where they correspond to several chips with different names.
This is a bit ugly, but at least it is simple and a bit more consistent to what we have now.
Maybe someone else has a better solution?
Thanks, -mattias
Signed-off-by: Mattias Mattsson vitplister@gmail.com
--- flashrom/flashchips.c 2011-07-22 01:21:47.000000000 +0200 +++ flashrom_uniform_chipnames/flashchips.c 2011-07-21 14:21:37.000000000 +0200 @@ -59,7 +59,7 @@
{ .vendor = "AMD", - .name = "Am29F010A/B", + .name = "Am29F010{,A,B}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = AMD_ID, .model_id = AMD_AM29F010B, /* Same as Am29F010A */ @@ -86,7 +86,7 @@
{ .vendor = "AMD", - .name = "Am29F002(N)BB", + .name = "Am29F002{,N}BB", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = AMD_ID, .model_id = AMD_AM29F002BB, @@ -118,7 +118,7 @@
{ .vendor = "AMD", - .name = "Am29F002(N)BT", + .name = "Am29F002{,N}BT", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = AMD_ID, .model_id = AMD_AM29F002BT, @@ -2242,7 +2242,7 @@
{ .vendor = "Atmel", - .name = "AT49F002(N)", + .name = "AT49F002{,N}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = ATMEL_ID, .model_id = ATMEL_AT49F002N, @@ -2274,7 +2274,7 @@
{ .vendor = "Atmel", - .name = "AT49F002(N)T", + .name = "AT49F002{,N}T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = ATMEL_ID, .model_id = ATMEL_AT49F002NT, @@ -3234,7 +3234,7 @@
{ .vendor = "Eon", - .name = "EN29F002(A)(N)B", + .name = "EN29F002{,N,A,AN}B", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = EON_ID, .model_id = EON_EN29F002B, @@ -3266,7 +3266,7 @@
{ .vendor = "Eon", - .name = "EN29F002(A)(N)T", + .name = "EN29F002{,N,A,AN}T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = EON_ID, .model_id = EON_EN29F002T, @@ -3518,7 +3518,7 @@
{ .vendor = "Intel", - .name = "28F001BN/BX-B", + .name = "28F001{BN,BX}-B", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F001B, @@ -3545,7 +3545,7 @@
{ .vendor = "Intel", - .name = "28F001BN/BX-T", + .name = "28F001{BN,BX}-T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F001T, @@ -3572,7 +3572,7 @@
{ .vendor = "Intel", - .name = "28F002BC/BL/BV/BX-T", + .name = "28F002{BC,BL,BV,BX}-T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F002T, @@ -3599,7 +3599,7 @@
{ .vendor = "Intel", - .name = "28F008S3/S5/SC", + .name = "28F008{S3,S5,SC}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F004S3, @@ -3622,7 +3622,7 @@
{ .vendor = "Intel", - .name = "28F004B5/BE/BV/BX-B", + .name = "28F004{B5,BE,BV,BX}-B", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F004B, @@ -3649,7 +3649,7 @@
{ .vendor = "Intel", - .name = "28F004B5/BE/BV/BX-T", + .name = "28F004{B5,BE,BV,BX}-T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F004T, @@ -3676,7 +3676,7 @@
{ .vendor = "Intel", - .name = "28F400BV/BX/CE/CV-B", + .name = "28F400{BV,BX,CE,CV}-B", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F400B, @@ -3704,7 +3704,7 @@
{ .vendor = "Intel", - .name = "28F400BV/BX/CE/CV-T", + .name = "28F400{BV,BX,CE,CV}-T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = INTEL_28F400T, @@ -6006,7 +6006,7 @@
{ .vendor = "SST", - .name = "SST49LF002A/B", + .name = "SST49LF002{A,B}", .bustype = CHIP_BUSTYPE_FWH, /* A/A Mux */ .manufacture_id = SST_ID, .model_id = SST_SST49LF002A, @@ -6038,7 +6038,7 @@
{ .vendor = "SST", - .name = "SST49LF003A/B", + .name = "SST49LF003{A,B}", .bustype = CHIP_BUSTYPE_FWH, /* A/A Mux */ .manufacture_id = SST_ID, .model_id = SST_SST49LF003A, @@ -6073,7 +6073,7 @@ * and is only honored for 64k block erase, but not 4k sector erase. */ .vendor = "SST", - .name = "SST49LF004A/B", + .name = "SST49LF004{A,B}", .bustype = CHIP_BUSTYPE_FWH, /* A/A Mux */ .manufacture_id = SST_ID, .model_id = SST_SST49LF004A, @@ -6869,7 +6869,7 @@
{ .vendor = "ST", - .name = "M29F002T/NT", + .name = "M29F002{,N}T", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = ST_ID, .model_id = ST_M29F002T, @@ -8035,7 +8035,7 @@
{ .vendor = "Winbond", - .name = "W29C010(M)/W29C011A/W29EE011/W29EE012", + .name = "W29{C010,C010M,C011A,EE011,EE012}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = WINBOND_ID, .model_id = WINBOND_W29C010, @@ -8058,7 +8058,7 @@
{ .vendor = "Winbond", - .name = "W29C020(C)/W29C022", + .name = "W29C0{20,20C,22}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = WINBOND_ID, .model_id = WINBOND_W29C020, @@ -8082,7 +8082,7 @@
{ .vendor = "Winbond", - .name = "W29C040/P", + .name = "W29C040{,P}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = WINBOND_ID, .model_id = WINBOND_W29C040, @@ -8106,7 +8106,7 @@
{ .vendor = "Winbond", - .name = "W29C010(M)/W29C011A/W29EE011/W29EE012", + .name = "W29{C010,C010M,C011A,EE011,EE012}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = WINBOND_ID, .model_id = WINBOND_W29C010, @@ -8361,7 +8361,7 @@
{ .vendor = "Winbond", - .name = "W49F002U/N", + .name = "W49F002U{,N}", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = WINBOND_ID, .model_id = WINBOND_W49F002U,
On Fri, 22 Jul 2011 01:41:17 +0200 Mattias Mattsson vitplister@gmail.com wrote:
This patch change the chipnames in flashchips.c to use bash style brace expansion syntax for chip IDs where they correspond to several chips with different names.
This is a bit ugly, but at least it is simple and a bit more consistent to what we have now.
Maybe someone else has a better solution?
hello matthias and thanks for your patch.
the current chip naming scheme has the capabilities to do what your patch does. most of the time it is already consistent in other cases we use a more human-readable approach (and in others there may be inconsistencies due to errors). let's look at an example to make clear what i mean with more human-readable:
.name = "W29C010(M)/W29C011A/W29EE011/W29EE012",
.name = "W29{C010,C010M,C011A,EE011,EE012}",
this could also be .name = "W29(C010(M)/C011A/EE011/EE012)", this would be even terser than the bash syntax (does that allow multi-level paranthesis?).
the chip names are used in -L and wiki output and its main purpose is to allow humans decide, if a chip is supported or not. having a consistent or machine-readable output is not the most important property in that use case.
consistency should be achieved as much as possible as long as it remains readable. i deem all syntaxes but the current one in the example above as too complicated to be (easily) readable. hence consistency (which seems to mean minimal string length) needs to be broken there.
i am not sure our general approach is good. there are lots of cultural (and individual) differences in understanding of symbols. so it may not be equally clear for everyone if A(B) means "A or AB" or for example "A or B". there is no "locale" for such things i guess... and it would probably not cut it anyway because there is a spread between individuals too, not only between countries/cultures.
if we change the names i would first like to discuss the new scheme. the only one that i could think of that would make sense are regular expressions. the reason is that at least most programmers know at least parts of its syntax (whereas the shell syntax you have used is for sure not widely known). the main question is though if any other scheme would be understood by more people than the current scheme. the current scheme is probably understood by most people of the (so-called) western culture to the degree that it fulfills the purpose of making chips identifiable. i am not so sure that regex would be better. and i am pretty sure the shell syntax is worse in that respect than the current scheme (sorry).
that said, killing inconsistency in the current naming is a good thing. you seem to have changed the semantic of a few names which indicates that the old names are wrong. for example:
.name = "W49F002U/N",
.name = "W49F002U{,N}",
this would be W49F002U(N) in the old syntax. i am not sure that either is correct: http://www.datasheetarchive.com/W49F002U*-datasheet.html but anyway.. i brought up this example only to say:
if there are problems with naming consistency in the current scheme please fix them first. reaching consensus about such a change is probably easier than about what you have suggested and it would improve flashrom quicker.