From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3B2FC433FE for ; Fri, 21 Oct 2022 13:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbiJUNQ1 (ORCPT ); Fri, 21 Oct 2022 09:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbiJUNQL (ORCPT ); Fri, 21 Oct 2022 09:16:11 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF07A52DF7; Fri, 21 Oct 2022 06:15:51 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A9EC21F8D2; Fri, 21 Oct 2022 13:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666358102; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KPkwRB0ZaXn3gTiwfIqXO+ySgLQVULSLT2Kgg3vEfks=; b=sCO1RpyQa5IzXzKe/KKbcuF+ShsCbLPJIsHCVdj+dv164p9qZJQrvERkVgqr4/Yt3bP0CP Ro4PNqM6FdB6oXuL5qAwW9nKX8/k0gzJ1gKAxN23ukxSrH3qo9onwtHYfHblkxwYheVH76 vR+CvRw6VXajBulvT+7GVwvkt4TCIFs= Received: from suse.cz (unknown [10.100.201.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 470E42C141; Fri, 21 Oct 2022 13:15:02 +0000 (UTC) Date: Fri, 21 Oct 2022 15:14:59 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: Re: [PATCH printk v2 09/38] netconsole: use console_is_enabled() Message-ID: References: <20221019145600.1282823-1-john.ogness@linutronix.de> <20221019145600.1282823-10-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221019145600.1282823-10-john.ogness@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2022-10-19 17:01:31, John Ogness wrote: > Replace (console->flags & CON_ENABLED) usage with console_is_enabled(). > > Signed-off-by: John Ogness The change is straightforward: Reviewed-by: Petr Mladek The comment below is just a lamentation about the netconsole code. > --- > drivers/net/netconsole.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > 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"); Just for record: This looks like a (mis)use of CON_ENABLED flag. It took me some time to understand why pre-enabled consoles are handled special way in register_console(). I partly documented it in try_enable_preferred_console(): /* * Some consoles, such as pstore and netconsole, can be enabled even * without matching. Accept the pre-enabled consoles only when match() * and setup() had a chance to be called. */ if (console_is_enabled(newcon) && (c->user_specified == user_specified)) return 0; In my bottom driver, I have a patch cleaning this. It is part of a bigger clean up that is not ready for upstream :-/ Best Regards, Petr