Skip to content

Commit cfb4fc5

Browse files
author
Ingo Molnar
committed
x86/cpuid: Standardize on u32 in <asm/cpuid/api.h>
Convert all uses of 'unsigned int' to 'u32' in <asm/cpuid/api.h>. This is how a lot of the call sites are doing it, and the two types are equivalent in the C sense - but 'u32' better expresses that these are expressions of an immutable hardware ABI. Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Xin Li (Intel) <[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 fb99ed1 commit cfb4fc5

File tree

1 file changed

+20
-20
lines changed
  • arch/x86/include/asm/cpuid

1 file changed

+20
-20
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ static inline bool have_cpuid_p(void)
2222
}
2323
#endif
2424

25-
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
26-
unsigned int *ecx, unsigned int *edx)
25+
static inline void native_cpuid(u32 *eax, u32 *ebx,
26+
u32 *ecx, u32 *edx)
2727
{
2828
/* ecx is often an input as well as an output. */
2929
asm volatile("cpuid"
@@ -36,9 +36,9 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
3636
}
3737

3838
#define NATIVE_CPUID_REG(reg) \
39-
static inline unsigned int native_cpuid_##reg(unsigned int op) \
39+
static inline u32 native_cpuid_##reg(u32 op) \
4040
{ \
41-
unsigned int eax = op, ebx, ecx = 0, edx; \
41+
u32 eax = op, ebx, ecx = 0, edx; \
4242
\
4343
native_cpuid(&eax, &ebx, &ecx, &edx); \
4444
\
@@ -65,19 +65,19 @@ NATIVE_CPUID_REG(edx)
6565
* Clear ECX since some CPUs (Cyrix MII) do not set or clear ECX
6666
* resulting in stale register contents being returned.
6767
*/
68-
static inline void cpuid(unsigned int op,
69-
unsigned int *eax, unsigned int *ebx,
70-
unsigned int *ecx, unsigned int *edx)
68+
static inline void cpuid(u32 op,
69+
u32 *eax, u32 *ebx,
70+
u32 *ecx, u32 *edx)
7171
{
7272
*eax = op;
7373
*ecx = 0;
7474
__cpuid(eax, ebx, ecx, edx);
7575
}
7676

7777
/* Some CPUID calls want 'count' to be placed in ECX */
78-
static inline void cpuid_count(unsigned int op, int count,
79-
unsigned int *eax, unsigned int *ebx,
80-
unsigned int *ecx, unsigned int *edx)
78+
static inline void cpuid_count(u32 op, int count,
79+
u32 *eax, u32 *ebx,
80+
u32 *ecx, u32 *edx)
8181
{
8282
*eax = op;
8383
*ecx = count;
@@ -88,43 +88,43 @@ static inline void cpuid_count(unsigned int op, int count,
8888
* CPUID functions returning a single datum:
8989
*/
9090

91-
static inline unsigned int cpuid_eax(unsigned int op)
91+
static inline u32 cpuid_eax(u32 op)
9292
{
93-
unsigned int eax, ebx, ecx, edx;
93+
u32 eax, ebx, ecx, edx;
9494

9595
cpuid(op, &eax, &ebx, &ecx, &edx);
9696

9797
return eax;
9898
}
9999

100-
static inline unsigned int cpuid_ebx(unsigned int op)
100+
static inline u32 cpuid_ebx(u32 op)
101101
{
102-
unsigned int eax, ebx, ecx, edx;
102+
u32 eax, ebx, ecx, edx;
103103

104104
cpuid(op, &eax, &ebx, &ecx, &edx);
105105

106106
return ebx;
107107
}
108108

109-
static inline unsigned int cpuid_ecx(unsigned int op)
109+
static inline u32 cpuid_ecx(u32 op)
110110
{
111-
unsigned int eax, ebx, ecx, edx;
111+
u32 eax, ebx, ecx, edx;
112112

113113
cpuid(op, &eax, &ebx, &ecx, &edx);
114114

115115
return ecx;
116116
}
117117

118-
static inline unsigned int cpuid_edx(unsigned int op)
118+
static inline u32 cpuid_edx(u32 op)
119119
{
120-
unsigned int eax, ebx, ecx, edx;
120+
u32 eax, ebx, ecx, edx;
121121

122122
cpuid(op, &eax, &ebx, &ecx, &edx);
123123

124124
return edx;
125125
}
126126

127-
static inline void __cpuid_read(unsigned int leaf, unsigned int subleaf, u32 *regs)
127+
static inline void __cpuid_read(u32 leaf, u32 subleaf, u32 *regs)
128128
{
129129
regs[CPUID_EAX] = leaf;
130130
regs[CPUID_ECX] = subleaf;
@@ -141,7 +141,7 @@ static inline void __cpuid_read(unsigned int leaf, unsigned int subleaf, u32 *re
141141
__cpuid_read(leaf, 0, (u32 *)(regs)); \
142142
}
143143

144-
static inline void __cpuid_read_reg(unsigned int leaf, unsigned int subleaf,
144+
static inline void __cpuid_read_reg(u32 leaf, u32 subleaf,
145145
enum cpuid_regs_idx regidx, u32 *reg)
146146
{
147147
u32 regs[4];

0 commit comments

Comments
 (0)