linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksey Makarov <aleksey.makarov@linaro.org>
To: linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org,
	Aleksey Makarov <aleksey.makarov@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: [PATCH 1/3] printk: make preferred_console local static bool
Date: Mon, 25 Jan 2016 17:45:21 +0600	[thread overview]
Message-ID: <1453722324-22407-2-git-send-email-aleksey.makarov@linaro.org> (raw)
In-Reply-To: <1453722324-22407-1-git-send-email-aleksey.makarov@linaro.org>

The variable preferred_console is used only inside register_console()
and it's semantics is boolean.  Make it clear.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 kernel/printk/printk.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 2ce8826..37e531f 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);
 
@@ -2456,6 +2455,7 @@ void register_console(struct console *newcon)
 	unsigned long flags;
 	struct console *bcon = NULL;
 	struct console_cmdline *c;
+	static bool preferred_console;
 
 	if (console_drivers)
 		for_each_console(bcon)
@@ -2482,15 +2482,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 (!preferred_console || bcon || !console_drivers)
+		preferred_console = 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 (!preferred_console) {
 		if (newcon->index < 0)
 			newcon->index = 0;
 		if (newcon->setup == NULL ||
@@ -2498,7 +2498,7 @@ void register_console(struct console *newcon)
 			newcon->flags |= CON_ENABLED;
 			if (newcon->device) {
 				newcon->flags |= CON_CONSDEV;
-				preferred_console = 0;
+				preferred_console = true;
 			}
 		}
 	}
@@ -2533,7 +2533,7 @@ void register_console(struct console *newcon)
 		newcon->flags |= CON_ENABLED;
 		if (i == selected_console) {
 			newcon->flags |= CON_CONSDEV;
-			preferred_console = selected_console;
+			preferred_console = true;
 		}
 		break;
 	}
-- 
2.7.0

  reply	other threads:[~2016-01-25 11:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 11:45 [PATCH 0/3] ACPI: parse the SPCR table Aleksey Makarov
2016-01-25 11:45 ` Aleksey Makarov [this message]
2016-01-25 12:45   ` [PATCH 1/3] printk: make preferred_console local static bool Joe Perches
2016-01-25 12:51     ` Aleksey Makarov
2016-01-25 13:23       ` Joe Perches
2016-01-25 13:28         ` Aleksey Makarov
2016-01-25 16:14           ` Peter Hurley
2016-01-25 14:24   ` Andy Shevchenko
2016-01-25 14:55     ` Aleksey Makarov
2016-01-25 11:45 ` [PATCH 2/3] ACPI: parse SPCR and enable matching console Aleksey Makarov
2016-01-25 14:14   ` Andy Shevchenko
2016-01-25 15:07     ` Aleksey Makarov
2016-01-25 16:32   ` Peter Hurley
2016-01-27 13:57     ` Aleksey Makarov
2016-01-28  0:45       ` Peter Hurley
2016-01-28 13:23         ` Aleksey Makarov
2016-01-28 19:40           ` Peter Hurley
2016-02-01  9:01   ` Graeme Gregory
2016-02-01  9:13     ` Graeme Gregory
2016-01-25 11:45 ` [PATCH 3/3] serial: pl011: add acpi_match for amba-pl011.c Aleksey Makarov
2016-01-25 14:21   ` Andy Shevchenko
2016-01-25 14:22     ` Andy Shevchenko
2016-01-25 15:08       ` Aleksey Makarov
2016-01-25 16:11 ` [PATCH 0/3] ACPI: parse the SPCR table Peter Hurley
2016-01-27 12:17   ` Aleksey Makarov
2016-01-27 13:45     ` One Thousand Gnomes
2016-02-01  5:46       ` Jon Masters
2016-02-10 23:39     ` Al Stone
2016-03-03 20:08       ` Peter Hurley
     [not found]         ` <67709E22-E82E-40BA-A271-2107608F4EF3@redhat.com>
2016-03-04 19:34           ` Peter Hurley
2016-03-04 20:03             ` Peter Hurley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453722324-22407-2-git-send-email-aleksey.makarov@linaro.org \
    --to=aleksey.makarov@linaro.org \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).