From: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<x86@kernel.org>, <hpa@zytor.com>,
<sean.j.christopherson@intel.com>, <liam.merwick@oracle.com>,
<mlevitsk@redhat.com>, <linux-kernel@vger.kernel.org>
Cc: <TimGuo-oc@zhaoxin.com>, <CooperYan@zhaoxin.com>,
<QiyuanWang@zhaoxin.com>, <HerryYang@zhaoxin.com>,
<CobeChen@zhaoxin.com>
Subject: [PATCH v1 1/2] x86/cpu: replace two-condition switch-case with if statement
Date: Tue, 8 Sep 2020 18:57:45 +0800 [thread overview]
Message-ID: <1599562666-31351-2-git-send-email-TonyWWang-oc@zhaoxin.com> (raw)
In-Reply-To: <1599562666-31351-1-git-send-email-TonyWWang-oc@zhaoxin.com>
Use if-case instead two-condition switch-case.
Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
---
arch/x86/kernel/cpu/centaur.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index c5cf336..5f811586 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -90,18 +90,14 @@ enum {
static void early_init_centaur(struct cpuinfo_x86 *c)
{
- switch (c->x86) {
#ifdef CONFIG_X86_32
- case 5:
- /* Emulate MTRRs using Centaur's MCR. */
+ /* Emulate MTRRs using Centaur's MCR. */
+ if (c->x86 == 5)
set_cpu_cap(c, X86_FEATURE_CENTAUR_MCR);
- break;
#endif
- case 6:
- if (c->x86_model >= 0xf)
- set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
- break;
- }
+ if (c->x86 == 6 && c->x86_model >= 0xf)
+ set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
+
#ifdef CONFIG_X86_64
set_cpu_cap(c, X86_FEATURE_SYSENTER32);
#endif
@@ -145,9 +141,8 @@ static void init_centaur(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
}
- switch (c->x86) {
#ifdef CONFIG_X86_32
- case 5:
+ if (c->x86 == 5) {
switch (c->x86_model) {
case 4:
name = "C6";
@@ -207,12 +202,10 @@ static void init_centaur(struct cpuinfo_x86 *c)
c->x86_cache_size = (cc>>24)+(dd>>24);
}
sprintf(c->x86_model_id, "WinChip %s", name);
- break;
+ }
#endif
- case 6:
+ if (c->x86 == 6)
init_c3(c);
- break;
- }
#ifdef CONFIG_X86_64
set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
#endif
--
2.7.4
next prev parent reply other threads:[~2020-09-08 13:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 10:57 [PATCH v1 0/2] add Centaur Family >= 7 CPUs support Tony W Wang-oc
2020-09-08 10:57 ` Tony W Wang-oc [this message]
2020-09-11 9:47 ` [tip: x86/cpu] x86/cpu/centaur: Replace two-condition switch-case with an if statement tip-bot2 for Tony W Wang-oc
2020-09-08 10:57 ` [PATCH v1 2/2] x86/cpu: add Centaur Family >=7 CPUs initialization support Tony W Wang-oc
2020-09-11 9:47 ` [tip: x86/cpu] x86/cpu/centaur: Add Centaur family " tip-bot2 for Tony W Wang-oc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1599562666-31351-2-git-send-email-TonyWWang-oc@zhaoxin.com \
--to=tonywwang-oc@zhaoxin.com \
--cc=CobeChen@zhaoxin.com \
--cc=CooperYan@zhaoxin.com \
--cc=HerryYang@zhaoxin.com \
--cc=QiyuanWang@zhaoxin.com \
--cc=TimGuo-oc@zhaoxin.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=liam.merwick@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®