[flashrom] [PATCH] Uniform chip names in flashchips.c

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Fri Jul 22 09:13:49 CEST 2011


On Fri, 22 Jul 2011 01:41:17 +0200
Mattias Mattsson <vitplister at 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.
-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner




More information about the flashrom mailing list