[patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers

From: Thomas Gleixner
Date: Fri Mar 20 2020 - 09:17:50 EST


The x86 CPU matching based on struct x86_cpu_id:

- is using an inconsistent macro mess with pointlessly duplicated and
slightly different local macros. Finding the places is an art as there
is no consistent name space at all.

- is still mostly based on C89 struct initializers which rely on the
ordering of the struct members. That's proliferated forever as every
new driver just copies the mess from some exising one.

A recent offlist conversation about adding more match criteria to the CPU
matching logic instead of creating yet another set of horrors, reminded me
of a pile of scripts and patches which I hacked on a few years ago when I
tried to add something to struct x86_cpu_id.

That stuff was finally not needed and ended up in my ever growing todo list
and collected dust and cobwebs, but (un)surprisingly enough most of it
still worked out of the box. The copy & paste machinery still works as it
did years ago.

There are a few places which needed extra care due to new creative macros,
new check combinations etc. and surprisingly ONE open coded proper C99
initializer.

It was reasonably simple to make it at least compile and pass a quick
binary equivalence check.

The result is a X86_MATCH prefix based set of macros which are reflecting
the needs of the usage sites and shorten the base macro which takes all
possible parameters (vendor, family, model, feature, data) and uses proper
C99 initializers.

So extensions of the match logic are trivial after that.

The patch set is against Linus tree and has trivial conflicts against
linux-next.

The diffstat is:
71 files changed, 525 insertions(+), 472 deletions(-)

but the extra lines are pretty much kernel-doc documentation which I added
to each of the new macros. The usage sites diffstat is:

70 files changed, 393 insertions(+), 471 deletions(-)

Thoughts?

Thanks,

tglx