From patchwork Wed Mar 15 10:28:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 95329 Delivered-To: patch@linaro.org Received: by 10.140.89.134 with SMTP id v6csp259078qgd; Wed, 15 Mar 2017 03:33:26 -0700 (PDT) X-Received: by 10.98.0.14 with SMTP id 14mr2872685pfa.173.1489574006860; Wed, 15 Mar 2017 03:33:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z43si1731683plh.7.2017.03.15.03.33.26; Wed, 15 Mar 2017 03:33:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbdCOKdU (ORCPT + 2 others); Wed, 15 Mar 2017 06:33:20 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:35537 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917AbdCOKdT (ORCPT ); Wed, 15 Mar 2017 06:33:19 -0400 Received: by mail-lf0-f48.google.com with SMTP id j90so4982616lfk.2 for ; Wed, 15 Mar 2017 03:33:17 -0700 (PDT) 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=oY1mpENif768Jws7VUzip9dV85qyQf1Lrn8hodOGHIE=; b=KbcSdUTKQmxU9h46a1a5yqEyd+xO7g3hJWKYHGcLh+690T0HJv7sA8em5ALYoMWm4I NLjFz1AP42W/kQrtm1tbf/Lqv38T0bcwQwCan3b/yMo8WMAZI+l1JRfUm7LrcUX0BsBq hwGvhiMkoerJy3s9pXjvyICvIEWP9LXzhZT2g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oY1mpENif768Jws7VUzip9dV85qyQf1Lrn8hodOGHIE=; b=px17+W9xioA3QU1STVSz0DgaArm4SavqG7haiQBYcM3SBR9LP2JkRQgXSfx+LpQaYF basEvyD2kVKvL9ufkh8HSxvX5Mr4dv8WldA2rTr4ifVselYsIF+8IMWXuGBYZ8ys/Fs8 cLzo0z1slmbiAM5RdzQj6Ie0O08c4fORWzp1U3UsR1G8p2WgmzXvynNVU9EMgjhFXs/r zdRC2tCdPqRNkkgMLQxXmANafjmAwqCoh56cLNXKIzhHmRrB5T+LaSIZ995+SVL3c0xi sG8AhQKQebr2POq2kz6qrBcuxGumXqXsib+MCIpyC2tFwvax2csK9oMqzB1tz42oU4gb Gj/A== X-Gm-Message-State: AFeK/H2xVYGOSTfZw92fsVOAIUvYhtMA74HDI5xZHeB4xBNwOk4h38F2xV9dE3MTwQ6XMbEu X-Received: by 10.46.80.89 with SMTP id v25mr458479ljd.33.1489573996964; Wed, 15 Mar 2017 03:33:16 -0700 (PDT) Received: from localhost.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id 4sm265163ljf.33.2017.03.15.03.33.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Mar 2017 03:33:16 -0700 (PDT) From: Aleksey Makarov To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Aleksey Makarov , Sudeep Holla , Greg Kroah-Hartman , Peter Hurley , Jiri Slaby , Robin Murphy , Steven Rostedt , "Nair, Jayachandran" , Sergey Senozhatsky , Petr Mladek Subject: [PATCH v5 1/3] printk: fix name/type/scope of preferred_console var Date: Wed, 15 Mar 2017 13:28:50 +0300 Message-Id: <20170315102854.1763-2-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170315102854.1763-1-aleksey.makarov@linaro.org> References: <20170315102854.1763-1-aleksey.makarov@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@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. Make it static bool and rename to has_preferred. Renaming was suggested by Peter Hurley Acked-by: Petr Mladek Reviewed-by: Steven Rostedt (VMware) Reviewed-by: Sergey Senozhatsky Signed-off-by: Aleksey Makarov --- kernel/printk/printk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 2984fb0f0257..80bc1b72d03d 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -271,7 +271,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); @@ -2409,6 +2408,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) @@ -2435,15 +2435,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 = selected_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 || @@ -2451,7 +2451,7 @@ void register_console(struct console *newcon) newcon->flags |= CON_ENABLED; if (newcon->device) { newcon->flags |= CON_CONSDEV; - preferred_console = 0; + has_preferred = true; } } } @@ -2486,7 +2486,7 @@ void register_console(struct console *newcon) newcon->flags |= CON_ENABLED; if (i == selected_console) { newcon->flags |= CON_CONSDEV; - preferred_console = selected_console; + has_preferred = true; } break; } From patchwork Wed Mar 15 10:28:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 95328 Delivered-To: patch@linaro.org Received: by 10.140.89.134 with SMTP id v6csp259082qgd; Wed, 15 Mar 2017 03:33:27 -0700 (PDT) X-Received: by 10.99.131.198 with SMTP id h189mr2877459pge.161.1489574007047; Wed, 15 Mar 2017 03:33:27 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z43si1731683plh.7.2017.03.15.03.33.26; Wed, 15 Mar 2017 03:33:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752373AbdCOKdX (ORCPT + 2 others); Wed, 15 Mar 2017 06:33:23 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:33870 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751642AbdCOKdW (ORCPT ); Wed, 15 Mar 2017 06:33:22 -0400 Received: by mail-lf0-f53.google.com with SMTP id z15so4998524lfd.1 for ; Wed, 15 Mar 2017 03:33:21 -0700 (PDT) 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=u7Ij3F4fefDEsWlBheu46QDm4zKP/+h9VCVrHhrzSXY=; b=Lo/W8oo58WkL6EwrfJXoiQBk7OmxcCyKFgSrVnxOaIYFoOr47HPSS6BYrzAqis0DuA O0JzQ7a0snpXBjr57wqZ5F+Q1BSHvrms4wP1TDfe00UonFFCxfpCV48380D8EMzZDS9w zbmfb2fYa+oGxPywLWOEOxolsBIQvlmO/gxRw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u7Ij3F4fefDEsWlBheu46QDm4zKP/+h9VCVrHhrzSXY=; b=oQ+3xE7Bm+jiV+sy3t0mBXjo/hadHHVoel82X+zXEUmYKz8f7HBTFPcn2DDLAR6vSL ymnFr584P6JXhsfjmot4B8dcGGM1eeWnCF60ixl3VPgwDoit2yNy6AuAuL+QrBclGRzy kH5CTexGoHvUWZ6zVE9VlRlBqeVYmD/hQbNNSXbNNsBf35FdUK7+eUKz0WMSqj1y57MG ooQqwZ4/uBaGJjQoR1lAX6hr2CTXPHFNifVnpFdhLpWEyWpOiMd9mwqVZDiNvYyVaWOn eO3aezuJ7fe9mcLANGRo8P2uj7PMk7EzhoSZ+5HNv88cibeauJXMUAafuFIA0c3jfFLF K3uw== X-Gm-Message-State: AFeK/H2CSy4tm6V5UkUVxC5zv1KTr0F0B6qxuQeZDPE3Y4KyPI2x7DQ8vZhxhGMZ8+T/MPWq X-Received: by 10.46.20.80 with SMTP id 16mr884723lju.81.1489574000197; Wed, 15 Mar 2017 03:33:20 -0700 (PDT) Received: from localhost.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id 4sm265163ljf.33.2017.03.15.03.33.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Mar 2017 03:33:19 -0700 (PDT) From: Aleksey Makarov To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Aleksey Makarov , Sudeep Holla , Greg Kroah-Hartman , Peter Hurley , Jiri Slaby , Robin Murphy , Steven Rostedt , "Nair, Jayachandran" , Sergey Senozhatsky , Petr Mladek Subject: [PATCH v5 2/3] printk: rename selected_console -> preferred_console Date: Wed, 15 Mar 2017 13:28:51 +0300 Message-Id: <20170315102854.1763-3-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170315102854.1763-1-aleksey.makarov@linaro.org> References: <20170315102854.1763-1-aleksey.makarov@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The variable selected_console is set in __add_preferred_console() to point to the last console parameter that was added to the console_cmdline array. Rename it to preferred_console so that the name reflects the usage. Petr Mladek: "[..] the selected_console/preferred_console value is used to keep the console first in the console_drivers list. IMHO, the main effect is that each line will first appear on this console, see call_console_drivers(). But the message will still appear also on all other enabled consoles. From this point, the name "preferred" sounds better to me. More consoles are selected (enabled) and only one is preferred (first)." Acked-by: Steven Rostedt (VMware) Acked-by: Petr Mladek Reviewed-by: Sergey Senozhatsky Suggested-by: Peter Hurley Signed-off-by: Aleksey Makarov --- kernel/printk/printk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 80bc1b72d03d..fd752f0c8ef1 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -270,7 +270,7 @@ 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); @@ -1910,14 +1910,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); @@ -2436,7 +2436,7 @@ void register_console(struct console *newcon) bcon = console_drivers; if (!has_preferred || bcon || !console_drivers) - has_preferred = selected_console >= 0; + has_preferred = preferred_console >= 0; /* * See if we want to use this console driver. If we @@ -2484,7 +2484,7 @@ void register_console(struct console *newcon) } newcon->flags |= CON_ENABLED; - if (i == selected_console) { + if (i == preferred_console) { newcon->flags |= CON_CONSDEV; has_preferred = true; }