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; }