All of
 help / color / mirror / Atom feed
* [patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers
@ 2020-03-20 13:13 ` Thomas Gleixner
  0 siblings, 0 replies; 161+ messages in thread
From: Thomas Gleixner @ 2020-03-20 13:13 UTC (permalink / raw)
  To: LKML
  Cc: x86, Greg Kroah-Hartman, Mark Gross, Tony Luck, Paolo Bonzini,
	Darren Hart, Andy Shevchenko, Rafael J. Wysocki, Len Brown,
	linux-acpi, Viresh Kumar, linux-pm, Srinivas Pandruvada,
	linux-edac, platform-driver-x86, Jean Delvare, Guenter Roeck,
	linux-hwmon, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Chanwoo Choi, Jacob Pan, Adrian Hunter, Ulf Hansson, linux-mmc,
	Bjorn Helgaas, linux-pci, Takashi Iwai, alsa-devel, Herbert Xu,
	David S. Miller, linux-crypto

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

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

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(-)




^ permalink raw reply	[flat|nested] 161+ messages in thread