Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1785612pxb; Wed, 9 Feb 2022 04:34:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBju1iz1ZjKn0gcNRKW02p2P9s++XemzcOz2Udb9j4blwEF2wC4+hfA7+tDr9qNfYTD6Rh X-Received: by 2002:a63:5f07:: with SMTP id t7mr1694193pgb.414.1644410092413; Wed, 09 Feb 2022 04:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644410092; cv=none; d=google.com; s=arc-20160816; b=IqA0lMVPhL6VKav1HWQ1pzKBQ8uMb7n1woP9ZkvUlYSQXuOVvAbQANQig8Dl3wRUuq kNh1fqq5jZGDOlzVqouMAPZL7yEMVXH8IIy3YkjtDuMrlx4muuv9xCqzpQQlwBxajt+c EbVBfJa4ryOxC5dkQmUb5t54OmaNX9pp3iIMrTXFvbhFAGgKn0Lj95htJae+BvQJoiF0 stvcSXzH0bjtzvdpmdaGoFaU5eNGmWD3sclV1OfVEWBt3liYg/weUsy2mUGvNUe8Airm 2KesXpeOzTGL6JerGE58MZSM+JBHmztYvpjihN27MwlmoYoJ1jxXazDZ1j1m6wwCJckA v9cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WijHXTObJseuOiFvlli9+l6jvFN1GY3799lbVAl5WkE=; b=UyRA7canjjwyh6Kw8fRScm2rXZWJ32qcEWWzwz5e847Io7DlmFDuij7ZV4T5MoGCoL BSnpNXy2Q9Wg/GeId0J9fhSOEeMhzmwI0FTC1aiPptZVeLaf6M3hi83GOEGpUzdgqeLD Z0Bm7+o3dSFrErNBFHzIlKEWQ8FihIXu0ha3Wthcxdz9lMG9XC9Ay0tcjoGeZeW/aGYV 4Z6JVYQLV9j3X8TpEq7B9dfdtgacT6QyaUpLLSu7SBE9N2n1OJsusXzrFEUCQ1Cp2J2A DvU/ZH4uhJpZN+n+rs81v4pR+CFN7Lh1SnQ3HljVWO2igDEdXj9Rl5LI85zJgwzdRsJB lsUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="Q/oTXjVz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q125si15196566pgq.311.2022.02.09.04.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:34:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="Q/oTXjVz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6BADEE13B027; Wed, 9 Feb 2022 02:22:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381130AbiBHPz3 (ORCPT + 99 others); Tue, 8 Feb 2022 10:55:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232356AbiBHPz1 (ORCPT ); Tue, 8 Feb 2022 10:55:27 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DDB4C061576 for ; Tue, 8 Feb 2022 07:55:27 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D9B4E1F387; Tue, 8 Feb 2022 15:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1644335725; 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=WijHXTObJseuOiFvlli9+l6jvFN1GY3799lbVAl5WkE=; b=Q/oTXjVzIERW9PT1/jqOi+5kUSo+JlJzQAki6xLupLsmyEFPvg+sF0ejxlPPXB4DmZBVDB AEgyHruOJN/0q12D3uaXghhnWeUV2B87jCmWhVLFetFM+G1xhIg4/7UJQI9VlXbJUqu2ZV VYiAjqrWFIelN1tUNEwmpM6blOPQ7z8= Received: from suse.cz (unknown [10.100.216.66]) (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 9E7D3A3B83; Tue, 8 Feb 2022 15:55:25 +0000 (UTC) Date: Tue, 8 Feb 2022 16:55:25 +0100 From: Petr Mladek To: Andre Kalb Cc: Sergey Senozhatsky , Steven Rostedt , John Ogness , linux-kernel@vger.kernel.org Subject: Re: [PATCH] printk: Set console_set_on_cmdline=1 when using console="" or console=null Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2022-01-28 00:00:52, Andre Kalb wrote: > In case of using console="" or console=null set console_set_on_cmdline=1 > to disable chosen{ "stdout-path" } node from devicetree. > > To jump out from drivers/of/base.c, line 2087 of_console_check function > with false. It makes sense. I would just fix it slightly different way, see below. > Signed-off-by: Andre Kalb > --- > kernel/printk/printk.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 82abfaf3c2aa..df5ab35b8af2 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2385,6 +2385,7 @@ static int __init console_setup(char *str) > */ > if (str[0] == 0 || strcmp(str, "null") == 0) { > __add_preferred_console("ttynull", 0, NULL, NULL, > true); > + console_set_on_cmdline = 1; We basically always need to set it when __add_preferred_console() is called with user_specified == true. Therefore, we should move the assigment into __add_preferred_console(). We should do something like: diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 82abfaf3c2aa..3654695ca5d2 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2324,6 +2324,15 @@ asmlinkage __visible void early_printk(const char *fmt, ...) } #endif +static void set_user_specified(struct console_cmdline *c, bool user_specified) +{ + if (!user_specified) + return; + + c->user_specified = true; + console_set_on_cmdline = 1; +} + static int __add_preferred_console(char *name, int idx, char *options, char *brl_options, bool user_specified) { @@ -2340,8 +2349,7 @@ static int __add_preferred_console(char *name, int idx, char *options, if (strcmp(c->name, name) == 0 && c->index == idx) { if (!brl_options) preferred_console = i; - if (user_specified) - c->user_specified = true; + set_user_specified(c, user_specified); return 0; } } @@ -2351,7 +2359,7 @@ static int __add_preferred_console(char *name, int idx, char *options, preferred_console = i; strlcpy(c->name, name, sizeof(c->name)); c->options = options; - c->user_specified = user_specified; + set_user_specified(c, user_specified); braille_set_options(c, brl_options); c->index = idx; @@ -2417,7 +2425,6 @@ static int __init console_setup(char *str) *s = 0; __add_preferred_console(buf, idx, options, brl_options, true); - console_set_on_cmdline = 1; return 1; } __setup("console=", console_setup); Best Regards, Petr