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: 8294481 Return-Path: X-Original-To: patchwork-linux-acpi@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 62BE2C02AA for ; Fri, 12 Feb 2016 17:51:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 763EC20429 for ; Fri, 12 Feb 2016 17:51:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E4DC2041F for ; Fri, 12 Feb 2016 17:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751974AbcBLRsz (ORCPT ); Fri, 12 Feb 2016 12:48:55 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:33122 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbcBLRsv (ORCPT ); Fri, 12 Feb 2016 12:48:51 -0500 Received: by mail-lf0-f51.google.com with SMTP id m1so56560511lfg.0 for ; Fri, 12 Feb 2016 09:48:50 -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=I+IyHxtuk7nseTSfBWrp26O7DztLMqEtpUB6QggMN/X7r6Qlg9GQphfuVrNEFrVfdN fdChBI7p9dQefbrySPfNIbE5vBo6inR/8dcbBLSASHWeQdFBbypIYFTWr/aiHRtpzBGM 5lkbsfYsAnD9HLjNkOtYjQs2BtwnGJgtq/5eaiQLexSx5tGqDABRtkYm6SXPkQisr93I goYXRLxAkO+TnfTYl54zozREJ7lGHUu2tuJvDF0754LIh9qw6mcUT3ABimu9vm+JoIqT 6nlqLHxpgr5y1EHBc9bztmQ1Ioskbxh16vkiTcnwGiGNJXZBmgZTUCYw3VLCAZrkRwMK mZcw== X-Gm-Message-State: AG10YOTrSKFSTkWL4uxaQrJTaYQn3KBlLExfJPi+Cxoq1XlrHwCeM30/8e/sibZ7tT1GZo1M 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 Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aleksey Makarov , Russell King , Greg Kroah-Hartman , "Rafael J . Wysocki" , Leif Lindholm , Graeme Gregory , Al Stone , Christopher Covington 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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; }