From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B10F2271A7C for ; Thu, 19 Feb 2026 14:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771510010; cv=none; b=A3j6Q41Vpfy1q1BMsBeTtRMmF/5ThwNM61gtZNLqXkJVxWmt33VY88OJPFhNsKVJrAy/laQfWzHE4Oy7cSscwlXCxZKKZ8do16SulZepFQhy2SAuj3VzZX/wy0ErGFjO3VaTpPqOdhqBKvBPqTKrMumFUtCCh5/njFtp7LvVnrc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771510010; c=relaxed/simple; bh=3UJhE0b71AkaRHI5N170kK9WVTNk2RO4H96f5UUlGMo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=F3imS/6qQeGW7/zSLH/yDhLoXmWeNxWsAt5rlgqOviw3t1ZBjBVz8QoBP4pKC2pI5xfuUBaRRgmTBkRRioZNkcN1s2uTTlhk8ZPW5vPaj5KCNBS/+edwTlps+A/+L/ZrwpU2Zx4aYopqBBB1rxwbFUmoF2weBnMylqyYmC6fjPg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cFnFueCZ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xfDv7DYZ; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cFnFueCZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xfDv7DYZ" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1771510002; h=from:from:reply-to:subject:subject: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=Mu/Dx8h2X0I73tn123sQmM2jnOJ9TS7cBsEdaPr7GK0=; b=cFnFueCZx30CSZBDncsxv+yxjWw3+8lG1oZqK9DE/wJ/zVM+e/koKlROTeGQPoItD6sYgS tF1h7ngnLFRez8DhPwNVZh67TUmzbqczJ4/iMDlv+J+W/McBEcrD3G7YqLoK+OrVy4fq1+ yuuCmhJdqk7/m4r8LhAUsvcAVRuHw58VOKvOnx5FODL9IaVGOQEo2spkyLkOu1mN0/b6B0 fDXG4jwJ08170a6nz+bwKCscCOokixOUa+SRxD0xuEQuWGcSR5QlxVW1pdeHoRGKgos1Ri ksdX7oo0SDmsvetKhWnXz75Ee9VpoVC9fRUSznFkGu8ZR2a48WpGstbUxbhbDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1771510002; h=from:from:reply-to:subject:subject: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=Mu/Dx8h2X0I73tn123sQmM2jnOJ9TS7cBsEdaPr7GK0=; b=xfDv7DYZSRQHmYiPDSHnUBr3qQZpeInUmoeADXsYpvwF9xCCyf3Zq8ogegvAWOwF03Fit1 DxUzSxJjc91pI5Cg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Chris Down , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/8] printk: Separate code for adding/updating preferred console metadata In-Reply-To: References: <20260206165002.496724-1-pmladek@suse.com> <20260206165002.496724-4-pmladek@suse.com> <87v7fwdbqw.fsf@jogness.linutronix.de> Date: Thu, 19 Feb 2026 15:12:41 +0106 Message-ID: <878qcon7ym.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On 2026-02-19, Petr Mladek wrote: >> On 2026-02-06, Petr Mladek wrote: >> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c >> > index 3f856a438e74..ee57c7ac9d02 100644 >> > --- a/kernel/printk/printk.c >> > +++ b/kernel/printk/printk.c >> > @@ -2491,18 +2491,82 @@ asmlinkage __visible void early_printk(const char *fmt, ...) >> > } >> > #endif >> > >> > -static void set_user_specified(struct preferred_console *pc, bool user_specified) >> > +static int update_preferred_console(int i, const char *name, const short idx, >> >> Perhaps @i should be unsigned in order to guarantee no possibility of >> negative array indexing. >> >> It would need to be defined that way in __add_preferred_console() as well. > > Makes sense. I'll do it in v2. Note that it might cause some warnings due to comparing signed and unsigned. It might be preferrable to check for non-negative rather than making it unsigned. > I am preparing v2 and added this: > > /** update_preferred_console - Update a given entry in the preferred_consoles[] > * table. > * @i: index of the entry in @preferred_consoles table which should get updated. > * @name: The name of the preferred console driver. > * @idx: Preferred console index, e.g. port number. > * @devname: The name of the preferred physical device. > * @options: Options used when setting up the console driver. > * @brl_options: Options used when setting up the console driver > * as a braille console. > * @user_specified: True if preferred via the kernel command line. > * > * The function ensures that the given values are consistent. Also > * it updates some global variables which are used to make the right > * decisions in register_console(). > * > * Rules: > * > * 1. Either @name and valid @idx OR @devname and @idx=-1 are allowed. > * Note that a valid @name and @idx will get assigned later when > * @devname matches during the device initialization. > * 2. Specify @brl_options if the console should be enabled as > * a Braille console [*] > * 3. Only matching entries can be updated. > * 4. @options passed via the command line are used when the same > * console is is preferred also by some platform-specific code. > * > * [*] Braille console is using the mechanism for registering consoles > * but it is very special. It is primary used for an user interaction > * with the system. Grammar fixup: It is primarily used for user interaction with the system. > * with the system. It neither gets printk() messages nor is > * associated with /dev/cosnole. /dev/console spelled wrong. > */ Otherwise, LGTM. I can provide reviewed-by tags once I look over v2. John