From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Aleksey Makarov <aleksey.makarov@linaro.org>,
Sabrina Dubroca <sd@queasysnail.net>,
Sudeep Holla <sudeep.holla@arm.com>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Petr Mladek <pmladek@suse.com>
Subject: [PATCH 1/3] printk/console: Remove superfluous setting of has_preferred state value
Date: Tue, 13 Jun 2017 14:54:02 +0200 [thread overview]
Message-ID: <1497358444-30736-2-git-send-email-pmladek@suse.com> (raw)
In-Reply-To: <1497358444-30736-1-git-send-email-pmladek@suse.com>
It is superfluous to set "has_preferred" when the really preferred
console is enabled. The variable "i" is index of an array. Therefore
"has_preferred" is set only when preferred_console is >= 0. But then
it was already true because of the above code:
if (!has_preferred || bcon || !console_drivers)
has_preferred = preferred_console >= 0;
This line was added by the commit ab4af03a4054bd78bc ("[PATCH] CON_CONSDEV
bit not set correctly on last console"). It was kind of logic to store
the really used index there. But this commit actually caused that
"preferred_console" started to be used only as a boolean. This was
discovered and corrected by the commit b077bafa2f3848ddfcef ("printk:
fix name/type/scope of preferred_console var").
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
kernel/printk/printk.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a1db38abac5b..8ebc480fdbc6 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2489,10 +2489,8 @@ void register_console(struct console *newcon)
}
newcon->flags |= CON_ENABLED;
- if (i == preferred_console) {
+ if (i == preferred_console)
newcon->flags |= CON_CONSDEV;
- has_preferred = true;
- }
break;
}
--
1.8.5.6
next prev parent reply other threads:[~2017-06-13 12:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 12:54 [PATCH 0/3] printk/console: Simplify the logic and always have a preferred console Petr Mladek
2017-06-13 12:54 ` Petr Mladek [this message]
2017-06-14 7:41 ` [PATCH 1/3] printk/console: Remove superfluous setting of has_preferred state value Sergey Senozhatsky
2017-06-13 12:54 ` [PATCH 2/3] printk/console: Clean up logic around fallback console Petr Mladek
2017-06-14 8:38 ` Sergey Senozhatsky
2017-06-15 15:31 ` Petr Mladek
2017-06-16 2:02 ` Sergey Senozhatsky
2017-06-13 12:54 ` [PATCH 3/3] printk/console: Always have a preferred console Petr Mladek
2017-06-14 9:11 ` Sergey Senozhatsky
2017-06-15 14:54 ` Petr Mladek
2017-06-16 2:00 ` Sergey Senozhatsky
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=1497358444-30736-2-git-send-email-pmladek@suse.com \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=aleksey.makarov@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sd@queasysnail.net \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=sudeep.holla@arm.com \
/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
all inboxes | Powered by JetHome®