x86/cpufeature: Fix various quality problems in the <asm/cpu_device_hd.h> header
authorIngo Molnar <mingo@kernel.org>
Mon, 11 Feb 2019 11:23:51 +0000 (12:23 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 11 Feb 2019 11:36:24 +0000 (12:36 +0100)
commit266d63a7d9d48c6d5dee486378ec0e8c86c4d74a
treeac27a54b3aa801d4c4a52ea2a35ad98878ed7e16
parent0f42b790c9ba5ec2f25b7da8b0b6d361082d67b0
x86/cpufeature: Fix various quality problems in the <asm/cpu_device_hd.h> header

Thomas noticed that the new arch/x86/include/asm/cpu_device_id.h header is
a train-wreck that didn't incorporate review feedback like not using __u8
in kernel-only headers.

While at it also fix all the *other* problems this header has:

 - Use canonical names for the header guards. It's inexplicable why a non-standard
   guard was used.

 - Don't define the header guard to 1. Plus annotate the closing #endif as done
   absolutely every other header. Again, an inexplicable source of noise.

 - Move the kernel API calls provided by this header next to each other, there's
   absolutely no reason to have them spread apart in the header.

 - Align the INTEL_CPU_DESC() macro initializations vertically, this is easier to
   read and it's also the canonical style.

 - Actually name the macro arguments properly: instead of 'mod, step, rev',
   spell out 'model, stepping, revision' - it's not like we have a lack of
   characters in this header.

 - Actually make arguments macro-safe - again it's inexplicable why it wasn't
   done properly to begin with.

Quite amazing how many problems a 41 lines header can contain.

This kind of code quality is unacceptable, and it slipped through the
review net of 2 developers and 2 maintainers, including myself, until
Thomas noticed it. :-/

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/cpu_device_id.h