Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp308180ybv; Thu, 13 Feb 2020 00:40:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzm0aGx0VQX8+6GpaIiANY/IyhTxx251z8zcZ8f61eSnTWnk93bK5aZmHnRZjJBmMOT2DdG X-Received: by 2002:aca:32c3:: with SMTP id y186mr2225816oiy.114.1581583208626; Thu, 13 Feb 2020 00:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581583208; cv=none; d=google.com; s=arc-20160816; b=u2zE5RahAMHglsfYWPY4C/xlbksg0n9w5rdJ4KCzs3oDovj7LruWudCJME1EeIIQW4 C4h6L+/w7b4IHwq9dmsyIWVH6cKCZy8JAoMytLU6d6KLmxY3pkuLO1tuoai0zK8G533N ZB+xggkPUag+HTcLzvxx1HGVctd+4KO36/HeKbBjKxaJ7+FV22V8BRSu4hcFE5jO0Ezc zaGghmt8II9J0b8ozyUcqFNqDhvF1NfSAQf2OLLn9WG4s3SKS+RFgKTn2O4crbdyZc+Z 9JwF3ftXAMBPDPiuOBLbGsdXNWuCtQsdaxKacfT0/CWe/0PVHm8ojYBWmJx6dZMSsTzN QWzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MnEN8sYg9A+LGx4Xtnjy+yqW7Dtk6axb7BBZZleLym0=; b=LKh6B41sFc/4ws0qs+G8Xo1ruVixTzn2xlf0u8h/RPfHNMkSF/2hsaufABBta+N+r+ oRZBC5Za+Qw1wv+7o+vHHd4qHj+ow2jBeK0CxfgaQLsPehLjVI9d6S3ehqGaOoPMvDsm Tc9x0agQ/N61enlAJ0szIiSRetPT3bH0nBXr7kIoqFn0Zxv/QBY6Ub+67ZzOFIAAbrI8 qHphe2o4fFCIZGZLxp67bJCmwF//qHDJx43DfHW5jJWBPL9lydjEU6+QCIPeTfLyzMog UQDHkYDrs4eU7LLGOCX6smF16p7cmmSVh8EHw2RqfJ9bPVWrRUr67hwGNYG4syy7T2NV CXNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si778189oie.265.2020.02.13.00.39.55; Thu, 13 Feb 2020 00:40:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729532AbgBMIjp (ORCPT + 99 others); Thu, 13 Feb 2020 03:39:45 -0500 Received: from mx2.suse.de ([195.135.220.15]:41500 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729485AbgBMIjo (ORCPT ); Thu, 13 Feb 2020 03:39:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 35667AFCE; Thu, 13 Feb 2020 08:39:43 +0000 (UTC) Date: Thu, 13 Feb 2020 09:39:42 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Benjamin Herrenschmidt , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/3] printk: Fix preferred console selection with multiple matches Message-ID: <20200213083942.6ue3ehaaycourgfi@pathway.suse.cz> References: <97dc50d411e10ac8aab1de0376d7a535fea8c60a.camel@kernel.crashing.org> <20200213055236.GE13208@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200213055236.GE13208@google.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-02-13 14:52:36, Sergey Senozhatsky wrote: > On (20/02/06 15:02), Benjamin Herrenschmidt wrote: > [..] > > static int __add_preferred_console(char *name, int idx, char *options, > > - char *brl_options) > > + char *brl_options, bool user_specified) > > { > > struct console_cmdline *c; > > int i; > > @@ -2131,6 +2131,8 @@ 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; > > return 0; > > } > > } > > @@ -2140,6 +2142,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; > > braille_set_options(c, brl_options); > > > > c->index = idx; > > @@ -2194,7 +2197,7 @@ static int __init console_setup(char *str) > > idx = simple_strtoul(s, NULL, 10); > > *s = 0; > > > > - __add_preferred_console(buf, idx, options, brl_options); > > + __add_preferred_console(buf, idx, options, brl_options, true); > > console_set_on_cmdline = 1; > > return 1; > > } > > @@ -2215,7 +2218,7 @@ __setup("console=", console_setup); > > */ > > int add_preferred_console(char *name, int idx, char *options) > > { > > - return __add_preferred_console(name, idx, options, NULL); > > + return __add_preferred_console(name, idx, options, NULL, false); > > } > > A silly question: > > Can the same console first be added by > console_setup()->__add_preferred_console(true) > and then by > add_preferred_console()->__add_preferred_console(false) I guess that this might happen. It should be safe because user_specified flag is set only to true when found again, see: if (user_specified) c->user_specified = true; Best Regards, Petr