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: 61874 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp967499lbl; Fri, 12 Feb 2016 09:49:02 -0800 (PST) X-Received: by 10.67.21.205 with SMTP id hm13mr3981681pad.56.1455299341821; Fri, 12 Feb 2016 09:49:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wk6si21204884pac.91.2016.02.12.09.49.01; Fri, 12 Feb 2016 09:49:01 -0800 (PST) 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; 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; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbcBLRsz (ORCPT + 30 others); Fri, 12 Feb 2016 12:48:55 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:34066 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbcBLRsv (ORCPT ); Fri, 12 Feb 2016 12:48:51 -0500 Received: by mail-lf0-f42.google.com with SMTP id j78so56279061lfb.1 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=GAnsVi/Bkcg8iXff14j1LpbIfJNpEuLwmF/UIfWvpNL5tj/lz3OJaB30ZW4SCQYdod 5foaeHSUd1hKsxzOrXVNgmOhLgBfVD7NIa9hEHJ3T7kEcrm4Rru1L+KjSLQSRWL6xMq0 08fo1RLVY7mj83mSzATdlmCM8G14kZQeULPRiWLF1k4Zli499xm1pli5N4UNPX8CosiM 64xKmLiqvCn3TDbmyj7MhmBAm0cMjKUC6SgW58VBf9lqwpJhznWN9om+voqJ5WkNTrOE h2RUylOVOqJndG1smQW4SHfrrMtqM9LPpDQVCv0xfk32dzGMoulNMwErBJo2KFn6iNFe 5ycA== X-Gm-Message-State: AG10YORC0I5XN1g0+lpnSWb/lBzm/MfM+JCdRVGpFWMfzsZvCxydaTgM8dJ7Hy0STCwZxtTS 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.0 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; }