Skip to content

Commit 8687bdc

Browse files
Tony W Wang-ocsuryasaimadhu
authored andcommitted
x86/cpu/centaur: Replace two-condition switch-case with an if statement
Use a normal if statements instead of a two-condition switch-case. [ bp: Massage commit message. ] Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/1599562666-31351-2-git-send-email-TonyWWang-oc@zhaoxin.com
1 parent 61aa9a0 commit 8687bdc

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

arch/x86/kernel/cpu/centaur.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,14 @@ enum {
9090

9191
static void early_init_centaur(struct cpuinfo_x86 *c)
9292
{
93-
switch (c->x86) {
9493
#ifdef CONFIG_X86_32
95-
case 5:
96-
/* Emulate MTRRs using Centaur's MCR. */
94+
/* Emulate MTRRs using Centaur's MCR. */
95+
if (c->x86 == 5)
9796
set_cpu_cap(c, X86_FEATURE_CENTAUR_MCR);
98-
break;
9997
#endif
100-
case 6:
101-
if (c->x86_model >= 0xf)
102-
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
103-
break;
104-
}
98+
if (c->x86 == 6 && c->x86_model >= 0xf)
99+
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
100+
105101
#ifdef CONFIG_X86_64
106102
set_cpu_cap(c, X86_FEATURE_SYSENTER32);
107103
#endif
@@ -145,9 +141,8 @@ static void init_centaur(struct cpuinfo_x86 *c)
145141
set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
146142
}
147143

148-
switch (c->x86) {
149144
#ifdef CONFIG_X86_32
150-
case 5:
145+
if (c->x86 == 5) {
151146
switch (c->x86_model) {
152147
case 4:
153148
name = "C6";
@@ -207,12 +202,10 @@ static void init_centaur(struct cpuinfo_x86 *c)
207202
c->x86_cache_size = (cc>>24)+(dd>>24);
208203
}
209204
sprintf(c->x86_model_id, "WinChip %s", name);
210-
break;
205+
}
211206
#endif
212-
case 6:
207+
if (c->x86 == 6)
213208
init_c3(c);
214-
break;
215-
}
216209
#ifdef CONFIG_X86_64
217210
set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
218211
#endif

0 commit comments

Comments
 (0)