From patchwork Fri Feb 12 17:43:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 8294411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC262C02AA for ; Fri, 12 Feb 2016 17:50:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C41D720421 for ; Fri, 12 Feb 2016 17:50:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DBF4D2041E for ; Fri, 12 Feb 2016 17:50:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUHqP-0007of-Me; Fri, 12 Feb 2016 17:49:25 +0000 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUHqB-0007hV-PM for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2016 17:49:14 +0000 Received: by mail-lf0-x233.google.com with SMTP id 78so56284675lfy.3 for ; Fri, 12 Feb 2016 09:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4R4/X8f16L/n5MFBbBaAuK+xhOcTjN+Xihh4XAU5+Gk=; b=P3hYOitQYVz61uBleoaW2XcuMtxL/GMybH/kSoVDJYLWzF/ZZzHPnIIfkRe1iNkH8O /IPpYrdcSIiolwfO83082vZ8FypjVTJKxafdPBehleK9JXx8C+2XrLlmnmT8OVugmTnx FASk+6tKA5uBBTfbefKaYe3hZl/Tci+ZBqnBI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4R4/X8f16L/n5MFBbBaAuK+xhOcTjN+Xihh4XAU5+Gk=; b=ODX9lfmrv25c4xeZKr1danH/MaxbI9WdM+TQNC3xVK1cbUQGy7sv+a8UUuSpy311ry ZNt6tJdTIftKRGXFk2Qr1Z8lyRvAwemElSit0uipdqSg34MB05TVJDXikp2gTFYUPBub Cr9zuMf9OdEEWNfauLlqg8eGsSUlsCqdbsfM+EIiu6vdmpX+HHudqY/oQVNZvGQBQ5IV 0RgWrNT5UcPoB5G9rnyyetk2rUBy8/POpk/5Od2NhAU8CV4OXfIS23btsahl/ZBwnoua 1Xy1WFVJ4s7un4XUkqw5GhYImtp9IuocACL8tyqoK59McprPYQx5R9V7Q6nKP2hSoWYW M6LA== X-Gm-Message-State: AG10YOTuekvI4UfwhayEzmW8TViLISmoZz4XBdAV7WVlRdJwiqLOABbQ/Il1XBa3wVLSwWep X-Received: by 10.25.16.196 with SMTP id 65mr1013753lfq.21.1455299329869; Fri, 12 Feb 2016 09:48:49 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id ei4sm2017549lbb.18.2016.02.12.09.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 09:48:49 -0800 (PST) From: Aleksey Makarov To: linux-acpi@vger.kernel.org Subject: [PATCH v2 1/9] printk: fix name and type of some variables Date: Fri, 12 Feb 2016 20:43:32 +0300 Message-Id: <1455299022-11641-2-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> References: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160212_094912_135334_A95E00BC X-CRM114-Status: GOOD ( 16.23 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , Graeme Gregory , Greg Kroah-Hartman , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Leif Lindholm , Aleksey Makarov , Christopher Covington , linux-serial@vger.kernel.org, Al Stone , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The variable preferred_console is used only inside register_console() and its semantics is boolean. It is negative when no console has been made preferred. The variable selected_console holds an index into the console_cmdline array, pointing to the console that was made preferred. Rename the variables: selected_console -> preferred_console preferred_console -> has_preferred and make the new has_preferred local static bool. This is a preparatory patch. To introduce selection with ACPI SPCR table we should decide which value (old) preferred_console should hold in the case when the console was set by ACPI. Renaming was suggested by Peter Hurley Signed-off-by: Aleksey Makarov Tested-by: Christopher Covington --- kernel/printk/printk.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index c963ba5..0cc9542 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -143,7 +143,6 @@ static struct console *exclusive_console; static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; -static int selected_console = -1; static int preferred_console = -1; int console_set_on_cmdline; EXPORT_SYMBOL(console_set_on_cmdline); @@ -1997,14 +1996,14 @@ static int __add_preferred_console(char *name, int idx, char *options, i++, c++) { if (strcmp(c->name, name) == 0 && c->index == idx) { if (!brl_options) - selected_console = i; + preferred_console = i; return 0; } } if (i == MAX_CMDLINECONSOLES) return -E2BIG; if (!brl_options) - selected_console = i; + preferred_console = i; strlcpy(c->name, name, sizeof(c->name)); c->options = options; braille_set_options(c, brl_options); @@ -2490,6 +2489,7 @@ void register_console(struct console *newcon) unsigned long flags; struct console *bcon = NULL; struct console_cmdline *c; + static bool has_preferred; if (console_drivers) for_each_console(bcon) @@ -2516,15 +2516,15 @@ void register_console(struct console *newcon) if (console_drivers && console_drivers->flags & CON_BOOT) bcon = console_drivers; - if (preferred_console < 0 || bcon || !console_drivers) - preferred_console = selected_console; + if (!has_preferred || bcon || !console_drivers) + has_preferred = preferred_console >= 0; /* * See if we want to use this console driver. If we * didn't select a console we take the first one * that registers here. */ - if (preferred_console < 0) { + if (!has_preferred) { if (newcon->index < 0) newcon->index = 0; if (newcon->setup == NULL || @@ -2532,7 +2532,7 @@ void register_console(struct console *newcon) newcon->flags |= CON_ENABLED; if (newcon->device) { newcon->flags |= CON_CONSDEV; - preferred_console = 0; + has_preferred = true; } } } @@ -2565,9 +2565,9 @@ void register_console(struct console *newcon) } newcon->flags |= CON_ENABLED; - if (i == selected_console) { + if (i == preferred_console) { newcon->flags |= CON_CONSDEV; - preferred_console = selected_console; + has_preferred = true; } break; }