Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp142174pxk; Fri, 11 Sep 2020 02:48:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI6BKpJgktCcAASewii8xARNCva2EhoHx72PiaQ6+YKqL6hE9Q948Uka/jINnqVaBEm3bt X-Received: by 2002:a17:906:a4e:: with SMTP id x14mr1209441ejf.112.1599817733965; Fri, 11 Sep 2020 02:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599817733; cv=none; d=google.com; s=arc-20160816; b=nt8lO46dDJhMfCJitOv7b55Rt57jhmriXzoP0qmFHZVThX2VqB7dSPetCexCWkyxkz oCKo05/4UJ49WUbRodw7zSwVF4zFnSD4IeEnrq6gzlhLCBv0uHEf1Om8il84Ijp47auF EWYJIBOqMpZh57X9UNbC/g1xgdHLr4XkWwKaELXvgZ6VeqdaAwzYwSMD7m4R8+8zPcqn lEfXKBha6lha3KDBnKWdCi1pM+wMMpdMin2pgXT+57UeVfgrdFlU+Aeei9KUoieSWzRk zGxvdTU2XXttBQPpoMKL0kBuhHy9Cm4PQuGAWGI6TFzId+Yr4QaY6QULEgmf8fqi5J5j wBag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=EoOdcw0nRDi+MO1u6dQUcRv24XIvpeGDZkOA9fR5tSg=; b=rrYV54A2oJfU5unGm4xZOOFdxK6saHejdkd+I4MSe2rMi1+VH9tn6UxzEsW+JVkYxq oge2Wl2j4JksQvybZe0JltDFsFUgpu18qNSdjWaohDOEZ8bNO3uImbpqA3K9i0a8Dft8 Pc1BgjQ88vlU6L32+txPGsbIvToD1lcEPWl/N16M6jpm3XCd9jyyNht/7vOfWuSFeHpi iq4Dr9yXXdTjj8KJtNFtp2GU/wWMWOVy520CY2p2R2Kr+OM+iHV2Nj4Giy23myEo9JW+ qYZsqRxNLfjzlyTGgMG29ZoMXtIAWKbTl7au7075BseRD1H3VDh0pfKlevjyuPlXPTFB t/pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b="Zkm/Pv7K"; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si964189edf.9.2020.09.11.02.48.30; Fri, 11 Sep 2020 02:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b="Zkm/Pv7K"; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725830AbgIKJrk (ORCPT + 99 others); Fri, 11 Sep 2020 05:47:40 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:45932 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbgIKJri (ORCPT ); Fri, 11 Sep 2020 05:47:38 -0400 Date: Fri, 11 Sep 2020 09:47:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1599817655; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EoOdcw0nRDi+MO1u6dQUcRv24XIvpeGDZkOA9fR5tSg=; b=Zkm/Pv7K3NZgA/mzcCzSptQgIZxeCbUCO3x+s61foLQnL2zdichA+c/Oqrq9Tm/SeOgTTy 3hfP2xdnjG/Y6dEdv1da0vntB/035npBIeTsb2gCEdEdpKFlJuChfBov9+4kwfIJTlmTDq Zo4Sov9ubvXST69WMFQRanf3QNNywpleUpCD9PC1W7qDUhk+5jcdEkMSFw/SU8V+sca7SS 2RSN7ZxuQwDZ4KguE5NCz6NK49AibMYTQrsEJBv1Hy/6XE/sP+ojUQNgEwy4gcNPwfdxlh aa+V6sc5FVyBFZoBo8mBCeEtRAy95/JrLMe1Q24e8901m6uL5txMNkOod6Urzg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1599817655; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EoOdcw0nRDi+MO1u6dQUcRv24XIvpeGDZkOA9fR5tSg=; b=Su8t3uIdds1He1ADkhS23APFTDR3PPldafIKlU9dq8oqM25Pw880zVMa+oEqSD75MTflie GPnKYNyROLrJJ2Ag== From: "tip-bot2 for Tony W Wang-oc" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/cpu/centaur: Replace two-condition switch-case with an if statement Cc: "Tony W Wang-oc" , Borislav Petkov , x86 , LKML In-Reply-To: <1599562666-31351-2-git-send-email-TonyWWang-oc@zhaoxin.com> References: <1599562666-31351-2-git-send-email-TonyWWang-oc@zhaoxin.com> MIME-Version: 1.0 Message-ID: <159981765495.4289.653078167108642899.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/cpu branch of tip: Commit-ID: 8687bdc04128b2bd16faaae11db10128ad0da7b8 Gitweb: https://git.kernel.org/tip/8687bdc04128b2bd16faaae11db10128ad0da7b8 Author: Tony W Wang-oc AuthorDate: Tue, 08 Sep 2020 18:57:45 +08:00 Committer: Borislav Petkov CommitterDate: Fri, 11 Sep 2020 10:50:01 +02:00 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 Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/1599562666-31351-2-git-send-email-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..5f81158 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