aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-02-11 06:23:51 -0500
committerIngo Molnar <mingo@kernel.org>2019-02-11 06:36:24 -0500
commit266d63a7d9d48c6d5dee486378ec0e8c86c4d74a (patch)
treeac27a54b3aa801d4c4a52ea2a35ad98878ed7e16
parent0f42b790c9ba5ec2f25b7da8b0b6d361082d67b0 (diff)
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>
-rw-r--r--arch/x86/include/asm/cpu_device_id.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/arch/x86/include/asm/cpu_device_id.h b/arch/x86/include/asm/cpu_device_id.h
index 3417110574c1..31c379c1da41 100644
--- a/arch/x86/include/asm/cpu_device_id.h
+++ b/arch/x86/include/asm/cpu_device_id.h
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _CPU_DEVICE_ID 2#ifndef _ASM_X86_CPU_DEVICE_ID
3#define _CPU_DEVICE_ID 1 3#define _ASM_X86_CPU_DEVICE_ID
4 4
5/* 5/*
6 * Declare drivers belonging to specific x86 CPUs 6 * Declare drivers belonging to specific x86 CPUs
@@ -9,8 +9,6 @@
9 9
10#include <linux/mod_devicetable.h> 10#include <linux/mod_devicetable.h>
11 11
12extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
13
14/* 12/*
15 * Match specific microcode revisions. 13 * Match specific microcode revisions.
16 * 14 *
@@ -22,21 +20,22 @@ extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
22 */ 20 */
23 21
24struct x86_cpu_desc { 22struct x86_cpu_desc {
25 __u8 x86_family; 23 u8 x86_family;
26 __u8 x86_vendor; 24 u8 x86_vendor;
27 __u8 x86_model; 25 u8 x86_model;
28 __u8 x86_stepping; 26 u8 x86_stepping;
29 __u32 x86_microcode_rev; 27 u32 x86_microcode_rev;
30}; 28};
31 29
32#define INTEL_CPU_DESC(mod, step, rev) { \ 30#define INTEL_CPU_DESC(model, stepping, revision) { \
33 .x86_family = 6, \ 31 .x86_family = 6, \
34 .x86_vendor = X86_VENDOR_INTEL, \ 32 .x86_vendor = X86_VENDOR_INTEL, \
35 .x86_model = mod, \ 33 .x86_model = (model), \
36 .x86_stepping = step, \ 34 .x86_stepping = (stepping), \
37 .x86_microcode_rev = rev, \ 35 .x86_microcode_rev = (revision), \
38} 36}
39 37
38extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
40extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table); 39extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
41 40
42#endif 41#endif /* _ASM_X86_CPU_DEVICE_ID */