From patchwork Tue May 21 07:22:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 164692 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1264941ili; Tue, 21 May 2019 00:24:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBJMqPjXj6WSj20+THuwYD4cBFCAbYOp4j3WgsZGB05u+HCZWoodleTFdxqhebbub8w1j2 X-Received: by 2002:a63:d016:: with SMTP id z22mr81104626pgf.116.1558423463155; Tue, 21 May 2019 00:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558423463; cv=none; d=google.com; s=arc-20160816; b=fhSs0Wd/rd1MjyOqpRPKG4UlhAs8C+bbN45K1H+OWWtoa3DSjHGZZ43aQ1YRTiYFhw CreuFNzac+Blk/XAxAIuO2m2poBZ2Ab7+BcGngMiw4xBK8+po6JG/xvVYfXax4/8zm02 YTzIdR4Kn0ZFvt0J5Co8X8FhE9umaP/hk5ADChxxt4Vwzmr1MSRIyoDyopNlu/5+h+WU LE2USAP6qLYLiBjhB8XTW+Fx06xtdJeQ7eF1YLCb+2LN/MTzmj2RyE50Q2/ekq/EDZgW 9mi4rv/QreyClnoy5yUM03GlXq5xIfSxagBrwdoyLFKgkRioyAyv1WwcYZh74Emt1gKa H/hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=hr8joM8Sc+Aak3eFwsotPo0Y8ZJsP4u2qZKEifJpDSc=; b=ZenHr6XQJiAglUoLt5JIzobQl5uJEUdDIzT/eAEqfOlqw1FP3CFc79PuDQupRR6mJS Ujb3wf3wNlCBEoX6d4NskeBQf5JFzgF2nXUhIJi+Ti9OlRT51JfOfyv9jF3NSUngLfTO EhDTsHxjIyx3F1GDCY0hdmdjwdU8abmH5/ANL2RsoITyk50K+pohWrxlh1bqlLpLPMkB HVJVNsRDLoebfdDpQODMPpCfYb7sXoMorVgrUFoEqbVX8oko95u/yxtFe7t/0Ry5UK9K K70f2eri8NBshB91/7ABBjBRjqytEF3GwITknbyDI5qVLv17MdivHLwWi0elDdLrBRaR RjnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=l7CH3GZi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si20959701plb.352.2019.05.21.00.24.22; Tue, 21 May 2019 00:24:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=l7CH3GZi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726931AbfEUHYW (ORCPT + 30 others); Tue, 21 May 2019 03:24:22 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:22820 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfEUHYV (ORCPT ); Tue, 21 May 2019 03:24:21 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x4L7MHPr022832; Tue, 21 May 2019 16:22:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x4L7MHPr022832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558423338; bh=hr8joM8Sc+Aak3eFwsotPo0Y8ZJsP4u2qZKEifJpDSc=; h=From:To:Cc:Subject:Date:From; b=l7CH3GZim9h0bMC3eGO7MyWPnzOAA8KNC8BCQDA1nQrXefb54KVJjgCD16vYHYF0F nSZLR5oes9Eg9Dw9BlAjPhLWfv9XTP4c4pEzm+NuMnU5gt70hwb9+AW/x+pxfEOEZR JMQgWpV6iF+kUEMGyFwS9L8UQPpZpA6PFtr2+7ygfw/hcYNSohDHv46+pxpgHvzWXP 66IeVxSAK8J7Odoj6PvUODZsZNWL9/Eco9y+CEgJrGlmSsdlBFHGjANZrEm6sOC9bb 2rnNYxZ4b6X0+fkF3ihTg2SGpbkhm8kMrQm8IXvzoOfvR1qMXxhf/araMXvjhtQB1f yd8HskED0bItA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , x86@kernel.org Cc: "H . Peter Anvin" , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] x86/io_delay: break instead of fallthrough in switch statement Date: Tue, 21 May 2019 16:22:10 +0900 Message-Id: <20190521072211.21014-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current code is fine since 'case CONFIG_IO_DELAY_TYPE_NONE' does nothing, but scripts/checkpatch.pl complains about this: warning: Possible switch case/default not preceded by break or fallthrough comment I like break statement better than a fallthrough comment here. It avoids the warning and clarify the code. No behavior change is intended. Signed-off-by: Masahiro Yamada --- arch/x86/kernel/io_delay.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c index 805b7a341aca..3dc874d5d43b 100644 --- a/arch/x86/kernel/io_delay.c +++ b/arch/x86/kernel/io_delay.c @@ -39,6 +39,7 @@ void native_io_delay(void) * are shorter until calibrated): */ udelay(2); + break; case CONFIG_IO_DELAY_TYPE_NONE: break; } From patchwork Tue May 21 07:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 164691 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1264774ili; Tue, 21 May 2019 00:24:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnHpZ2YhMZ+MHZe9ZzGepf7aAoqXiELwoWaW/BDCGA32einL7P9kkNuu/6DlevTgLByxBM X-Received: by 2002:a62:e303:: with SMTP id g3mr84831794pfh.220.1558423450333; Tue, 21 May 2019 00:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558423450; cv=none; d=google.com; s=arc-20160816; b=v7ZG/AkNf0ldQTT3w52QUsxVYYbR4rAuraNTCGVKDDNG/TneS73Qy0uYOePiroXnfx MisCX2nAHz6BZmaKaqmPW6DGt0BbWzyo0cgtXV8b/qbF/z6KWSEfhISbdcgUjy1In84H 0wVMEy/UIE975KPudY3uRdqGzYVhZgG2NJdLjmUeobGh1z4IbrVQoYdvI+FxJqEUcxs4 6aL1PamEZn0H8Ka6btXnId7AhIuzAQoCG7jsrVlF9VEKl/Wqhaw/yBh/k6D5QTIdxMk9 +R5uRulaSh1n+Ehs0C8jE12S1LDr2DJnSyQgEhmBUb2Uqe/RoM2P0FqyMnBRvKaK80v6 MGwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=cqf/OA7v0beVGYTBfCLFXz4KvzaltleguuA8BoAdm58=; b=AfuIuYrVX7ADbNMQavr7VReJEBQtSqBBL7kBl1UKZg+fYWpVHi1VO6C01aeUdkinbv rKpYtUhKkrjsj+tnkwC4OGEMGnIkjl/0Eo506i15JyK1j8RHDHmMH7g8hJRcVjY5gs/u G95hCwNPaMdTsOw5KcDlfTgRgipirq0i4l7i3FpEjpC7V7CGz0dtbwSHLBhD6VCSIajl nrc4FDLVyAJvdDepGdzYebcC33xA7msjI3xgM1KYez+JNijV4jYEYKYcEPQPaQ+1oQFl LAA4Ik11auq4l5YDLeCjy/yaJiJ8ggTUrPfJFO0hXD9yfYIRy5aSbCcD2uDP9ORrkJVk CKPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oYYi5+wK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si20959701plb.352.2019.05.21.00.24.09; Tue, 21 May 2019 00:24:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oYYi5+wK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbfEUHYI (ORCPT + 30 others); Tue, 21 May 2019 03:24:08 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:22389 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbfEUHYI (ORCPT ); Tue, 21 May 2019 03:24:08 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x4L7MHPs022832; Tue, 21 May 2019 16:22:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x4L7MHPs022832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558423339; bh=cqf/OA7v0beVGYTBfCLFXz4KvzaltleguuA8BoAdm58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYYi5+wKBbBtQKFDMZ5zDSJqB0++eS0fQ7rtdyJlTC5qQwzKttsnGLXUsN5jdcqXS fKtrWaFmC0yBV2u7TE2ilRQcy+QnVPAwLrIwtbT0erjK6jpp1nyO4cMLOteruaY07W m+TpZywYINXk/ShQglGQr0O8z4qfQPDpm9uT49cmxPij8oKn4TNlCpFr4LNx4TvEns d+/dGIsTl3pWNcbwem15SBMTpGgg31AsDe6zMcl1ym2+Zmzp5XnuNC9KjOQ5ppBno6 8AZ+3CGyibut+0/lV71haPMm8tUN9BC5TeqmadfXxGil02trpMQt/iSCnFTuLaxcwr 8BFQysmo9WtaQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , x86@kernel.org Cc: "H . Peter Anvin" , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] x86/io_delay: define IO_DELAY macros in C instead of Kconfig Date: Tue, 21 May 2019 16:22:11 +0900 Message-Id: <20190521072211.21014-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190521072211.21014-1-yamada.masahiro@socionext.com> References: <20190521072211.21014-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CONFIG_IO_DELAY_TYPE_* are not kernel configuration at all. They just define constant values, 0, 1, 2, and 3. Define them by #define in C. CONFIG_DEFAULT_IO_DELAY_TYPE can also be defined in C by using #ifdef and #define directives. Signed-off-by: Masahiro Yamada --- arch/x86/Kconfig.debug | 44 -------------------------------------- arch/x86/kernel/io_delay.c | 37 ++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 55 deletions(-) -- 2.17.1 diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index f730680dc818..6791a3c97589 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug @@ -179,26 +179,6 @@ config X86_DECODER_SELFTEST decoder code. If unsure, say "N". -# -# IO delay types: -# - -config IO_DELAY_TYPE_0X80 - int - default "0" - -config IO_DELAY_TYPE_0XED - int - default "1" - -config IO_DELAY_TYPE_UDELAY - int - default "2" - -config IO_DELAY_TYPE_NONE - int - default "3" - choice prompt "IO delay type" default IO_DELAY_0X80 @@ -229,30 +209,6 @@ config IO_DELAY_NONE endchoice -if IO_DELAY_0X80 -config DEFAULT_IO_DELAY_TYPE - int - default IO_DELAY_TYPE_0X80 -endif - -if IO_DELAY_0XED -config DEFAULT_IO_DELAY_TYPE - int - default IO_DELAY_TYPE_0XED -endif - -if IO_DELAY_UDELAY -config DEFAULT_IO_DELAY_TYPE - int - default IO_DELAY_TYPE_UDELAY -endif - -if IO_DELAY_NONE -config DEFAULT_IO_DELAY_TYPE - int - default IO_DELAY_TYPE_NONE -endif - config DEBUG_BOOT_PARAMS bool "Debug boot parameters" depends on DEBUG_KERNEL diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c index 3dc874d5d43b..fdb6506ceaaa 100644 --- a/arch/x86/kernel/io_delay.c +++ b/arch/x86/kernel/io_delay.c @@ -13,7 +13,22 @@ #include #include -int io_delay_type __read_mostly = CONFIG_DEFAULT_IO_DELAY_TYPE; +#define IO_DELAY_TYPE_0X80 0 +#define IO_DELAY_TYPE_0XED 1 +#define IO_DELAY_TYPE_UDELAY 2 +#define IO_DELAY_TYPE_NONE 3 + +#if defined(CONFIG_IO_DELAY_0X80) +#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_0X80 +#elif defined(CONFIG_IO_DELAY_0XED) +#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_0XED +#elif defined(CONFIG_IO_DELAY_UDELAY) +#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_UDELAY +#elif defined(CONFIG_IO_DELAY_NONE) +#define DEFAULT_IO_DELAY_TYPE IO_DELAY_TYPE_NONE +#endif + +int io_delay_type __read_mostly = DEFAULT_IO_DELAY_TYPE; static int __initdata io_delay_override; @@ -24,13 +39,13 @@ void native_io_delay(void) { switch (io_delay_type) { default: - case CONFIG_IO_DELAY_TYPE_0X80: + case IO_DELAY_TYPE_0X80: asm volatile ("outb %al, $0x80"); break; - case CONFIG_IO_DELAY_TYPE_0XED: + case IO_DELAY_TYPE_0XED: asm volatile ("outb %al, $0xed"); break; - case CONFIG_IO_DELAY_TYPE_UDELAY: + case IO_DELAY_TYPE_UDELAY: /* * 2 usecs is an upper-bound for the outb delay but * note that udelay doesn't have the bus-level @@ -40,7 +55,7 @@ void native_io_delay(void) */ udelay(2); break; - case CONFIG_IO_DELAY_TYPE_NONE: + case IO_DELAY_TYPE_NONE: break; } } @@ -48,9 +63,9 @@ EXPORT_SYMBOL(native_io_delay); static int __init dmi_io_delay_0xed_port(const struct dmi_system_id *id) { - if (io_delay_type == CONFIG_IO_DELAY_TYPE_0X80) { + if (io_delay_type == IO_DELAY_TYPE_0X80) { pr_notice("%s: using 0xed I/O delay port\n", id->ident); - io_delay_type = CONFIG_IO_DELAY_TYPE_0XED; + io_delay_type = IO_DELAY_TYPE_0XED; } return 0; @@ -116,13 +131,13 @@ static int __init io_delay_param(char *s) return -EINVAL; if (!strcmp(s, "0x80")) - io_delay_type = CONFIG_IO_DELAY_TYPE_0X80; + io_delay_type = IO_DELAY_TYPE_0X80; else if (!strcmp(s, "0xed")) - io_delay_type = CONFIG_IO_DELAY_TYPE_0XED; + io_delay_type = IO_DELAY_TYPE_0XED; else if (!strcmp(s, "udelay")) - io_delay_type = CONFIG_IO_DELAY_TYPE_UDELAY; + io_delay_type = IO_DELAY_TYPE_UDELAY; else if (!strcmp(s, "none")) - io_delay_type = CONFIG_IO_DELAY_TYPE_NONE; + io_delay_type = IO_DELAY_TYPE_NONE; else return -EINVAL;