From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH printk v2 09/38] netconsole: use console_is_enabled()
Date: Fri, 04 Nov 2022 16:18:41 +0106 [thread overview]
Message-ID: <87h6ze7nyu.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <Y1KbU2r09bEm2rHX@alley>
On 2022-10-21, Petr Mladek <pmladek@suse.com> wrote:
>> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
>> index bdff9ac5056d..073e59a06f21 100644
>> --- a/drivers/net/netconsole.c
>> +++ b/drivers/net/netconsole.c
>> @@ -332,7 +332,7 @@ static ssize_t enabled_store(struct config_item *item,
>> }
>>
>> if (enabled) { /* true */
>> - if (nt->extended && !(netconsole_ext.flags & CON_ENABLED)) {
>> + if (nt->extended && !console_is_enabled(&netconsole_ext)) {
>> netconsole_ext.flags |= CON_ENABLED;
>> register_console(&netconsole_ext);
>> }
>> @@ -915,7 +915,7 @@ static int __init init_netconsole(void)
>> if (err)
>> goto undonotifier;
>>
>> - if (netconsole_ext.flags & CON_ENABLED)
>> + if (console_is_enabled(&netconsole_ext))
>> register_console(&netconsole_ext);
>> register_console(&netconsole);
>> pr_info("network logging started\n");
>
> This looks like a (mis)use of CON_ENABLED flag.
Yes. When @netconsole_ext is registered, CON_ENABLED is always set. So
it should be set in the static initialization. The first hunk should be
using the new console_is_registered(). The second hunk should be using a
local @extended bool variable. Also, in cleanup_netconsole() it should
check if the console is registered:
if (console_is_registered(&netconsole_ext))
unregister_console(&netconsole_ext);
I will make all of these changes for v3. Then there will be no
checking/setting of CON_ENABLED in the driver.
John Ogness
prev parent reply other threads:[~2022-11-04 15:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 14:55 [PATCH printk v2 00/38] reduce console_lock scope John Ogness
2022-10-19 14:55 ` [PATCH printk v2 09/38] netconsole: use console_is_enabled() John Ogness
2022-10-21 13:14 ` Petr Mladek
2022-11-04 15:12 ` John Ogness [this message]
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=87h6ze7nyu.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tglx@linutronix.de \
/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