The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	Chris Down <chris@chrisdown.name>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/9] printk: Separate code for adding/updating preferred console metadata
Date: Fri, 29 May 2026 12:06:36 +0200	[thread overview]
Message-ID: <ahllLAkTaj9W0Anj@pathway> (raw)
In-Reply-To: <87lddl6k2l.fsf@jogness.linutronix.de>

On Fri 2026-05-15 12:36:58, John Ogness wrote:
> On 2026-05-15, John Ogness <john.ogness@linutronix.de> wrote:
> >> +		if (!pc->name[0]) {
> >> +			strscpy(pc->name, name);
> >> +			pc->index = idx;
> >
> > Here is the copied code. This block is about setting the name.
> >
> >> +		} else if (strcmp(pc->name, name) != 0 || pc->index != idx) {
> >> +			pr_err("Updating a preferred console with an invalid name or index: %s%d vs. %s%d\n",
> >> +			       pc->name, pc->index, name, idx);
> >> +			return -EINVAL;
> >> +		}
> >> +	}
> >
> > I would put the index setting here as it is relevant regardless of how
> > the devname or name was updated.
> >
> > 	pc->index = idx;
> 
> Ah, I guess you only wanted to update @index if it is a new entry
> (because otherwise it will already have the value of @idx).

Exactly ;-)

> If you want to keep the index setting in the devname and name blocks,
> maybe just adding a comment to clarify it is a new entry:
> 
> 	if (!pc->devname[0]) {
> 		/* This is a new entry */
> 		strscpy(pc->devname, devname);
> 		pc->index = idx;
> 
> ...
> 
> 	if (!pc->name[0]) {
> 		/* This is a new entry */
> 		strscpy(pc->name, name);
> 		pc->index = idx;

I am going to add the comments in v3.

Best Regards,
Petr

  reply	other threads:[~2026-05-29 10:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 13:00 [PATCH v2 0/9] printk: Clean up preferred console handling Petr Mladek
2026-04-23 13:00 ` [PATCH v2 1/9] printk: Rename struct console_cmdline to preferred_console Petr Mladek
2026-04-23 14:16   ` Steven Rostedt
2026-05-08 14:22   ` John Ogness
2026-04-23 13:00 ` [PATCH v2 2/9] printk: Rename preferred_console to preferred_dev_console Petr Mladek
2026-05-15  9:07   ` John Ogness
2026-04-23 13:00 ` [PATCH v2 3/9] printk: Separate code for adding/updating preferred console metadata Petr Mladek
2026-05-05 17:47   ` Marcos Paulo de Souza
2026-05-15 10:23   ` John Ogness
2026-05-15 10:30     ` John Ogness
2026-05-29 10:06       ` Petr Mladek [this message]
2026-05-29 10:05     ` Petr Mladek
2026-04-23 13:00 ` [PATCH v2 4/9] printk: Cleanup _braille_(un)register_console() wrappers Petr Mladek
2026-05-15 12:51   ` John Ogness
2026-04-23 13:00 ` [PATCH v2 5/9] printk: Separate code for enabling console Petr Mladek
2026-05-05 17:56   ` Marcos Paulo de Souza
2026-05-15 12:57   ` John Ogness
2026-04-23 13:00 ` [PATCH v2 6/9] printk: Try to register each console as Braille first Petr Mladek
2026-04-23 13:00 ` [PATCH v2 7/9] printk: Do not set Braille console as preferred_console Petr Mladek
2026-04-23 13:00 ` [PATCH v2 8/9] printk: Handle pre-enabled consoles in the top-level try_enable_console() Petr Mladek
2026-04-23 13:00 ` [PATCH v2 9/9] printk: Try enable preferred consoles only when there are any Petr Mladek
2026-05-29 15:22   ` Petr Mladek
2026-04-24  8:20 ` [PATCH v2 0/9] printk: Clean up preferred console handling Petr Mladek

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=ahllLAkTaj9W0Anj@pathway \
    --to=pmladek@suse.com \
    --cc=chris@chrisdown.name \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpdesouza@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /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