Skip to content

Commit fb99ed1

Browse files
author
Ingo Molnar
committed
x86/cpuid: Clean up <asm/cpuid/api.h>
- Include <asm/cpuid/types.h> first, as is customary. This also has the side effect of build-testing the header dependency assumptions in the types header. - No newline necessary after the SPDX line - Newline necessary after inline function definitions - Rename native_cpuid_reg() to NATIVE_CPUID_REG(): it's a CPP macro, whose name we capitalize in such cases. - Prettify the CONFIG_PARAVIRT_XXL inclusion block a bit - Standardize register references in comments to EAX/EBX/ECX/etc., from the hodgepodge of references. - s/cpus/CPUs because why add noise to common acronyms? Signed-off-by: Ingo Molnar <[email protected]> Cc: Andrew Cooper <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: John Ogness <[email protected]> Cc: "Ahmed S. Darwish" <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 04a1007 commit fb99ed1

File tree

1 file changed

+16
-14
lines changed
  • arch/x86/include/asm/cpuid

1 file changed

+16
-14
lines changed

arch/x86/include/asm/cpuid/api.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
2-
32
#ifndef _ASM_X86_CPUID_API_H
43
#define _ASM_X86_CPUID_API_H
54

5+
#include <asm/cpuid/types.h>
6+
67
#include <linux/build_bug.h>
78
#include <linux/types.h>
89

9-
#include <asm/cpuid/types.h>
1010
#include <asm/string.h>
1111

1212
/*
13-
* Raw CPUID accessors
13+
* Raw CPUID accessors:
1414
*/
1515

1616
#ifdef CONFIG_X86_32
@@ -21,6 +21,7 @@ static inline bool have_cpuid_p(void)
2121
return true;
2222
}
2323
#endif
24+
2425
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
2526
unsigned int *ecx, unsigned int *edx)
2627
{
@@ -34,7 +35,7 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
3435
: "memory");
3536
}
3637

37-
#define native_cpuid_reg(reg) \
38+
#define NATIVE_CPUID_REG(reg) \
3839
static inline unsigned int native_cpuid_##reg(unsigned int op) \
3940
{ \
4041
unsigned int eax = op, ebx, ecx = 0, edx; \
@@ -45,22 +46,23 @@ static inline unsigned int native_cpuid_##reg(unsigned int op) \
4546
}
4647

4748
/*
48-
* Native CPUID functions returning a single datum.
49+
* Native CPUID functions returning a single datum:
4950
*/
50-
native_cpuid_reg(eax)
51-
native_cpuid_reg(ebx)
52-
native_cpuid_reg(ecx)
53-
native_cpuid_reg(edx)
51+
NATIVE_CPUID_REG(eax)
52+
NATIVE_CPUID_REG(ebx)
53+
NATIVE_CPUID_REG(ecx)
54+
NATIVE_CPUID_REG(edx)
5455

5556
#ifdef CONFIG_PARAVIRT_XXL
56-
#include <asm/paravirt.h>
57+
# include <asm/paravirt.h>
5758
#else
58-
#define __cpuid native_cpuid
59+
# define __cpuid native_cpuid
5960
#endif
6061

6162
/*
6263
* Generic CPUID function
63-
* clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
64+
*
65+
* Clear ECX since some CPUs (Cyrix MII) do not set or clear ECX
6466
* resulting in stale register contents being returned.
6567
*/
6668
static inline void cpuid(unsigned int op,
@@ -72,7 +74,7 @@ static inline void cpuid(unsigned int op,
7274
__cpuid(eax, ebx, ecx, edx);
7375
}
7476

75-
/* Some CPUID calls want 'count' to be placed in ecx */
77+
/* Some CPUID calls want 'count' to be placed in ECX */
7678
static inline void cpuid_count(unsigned int op, int count,
7779
unsigned int *eax, unsigned int *ebx,
7880
unsigned int *ecx, unsigned int *edx)
@@ -83,7 +85,7 @@ static inline void cpuid_count(unsigned int op, int count,
8385
}
8486

8587
/*
86-
* CPUID functions returning a single datum
88+
* CPUID functions returning a single datum:
8789
*/
8890

8991
static inline unsigned int cpuid_eax(unsigned int op)

0 commit comments

Comments
 (0)