[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240328103310.hd4z2bt6cvje5hbo@dhruva>
Date: Thu, 28 Mar 2024 16:03:10 +0530
From: Dhruva Gole <d-gole@...com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Tony Lindgren <tony@...mide.com>, Jiri Slaby <jirislaby@...nel.org>,
Jonathan Corbet <corbet@....net>, Petr Mladek <pmladek@...e.com>,
Steven
Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
"David S . Miller"
<davem@...emloft.net>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Johan Hovold
<johan@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Vignesh Raghavendra <vigneshr@...com>, <linux-kernel@...r.kernel.org>,
<linux-serial@...r.kernel.org>, Sebastian Reichel <sre@...nel.org>,
<linux-doc@...r.kernel.org>
Subject: Re: [PATCH v7 4/7] serial: core: Add support for DEVNAME:0.0 style
naming for kernel console
On Mar 28, 2024 at 08:22:26 +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 28, 2024 at 12:01:52PM +0530, Dhruva Gole wrote:
> > Hi,
> >
> > On Mar 27, 2024 at 12:59:38 +0200, Tony Lindgren wrote:
> > > We can now add hardware based addressing for serial ports. Starting with
> > > commit 84a9582fd203 ("serial: core: Start managing serial controllers to
> > > enable runtime PM"), and all the related fixes to this commit, the serial
> > > core now knows to which serial port controller the ports are connected.
[...]
> > >
> > > +#ifdef CONFIG_SERIAL_CORE_CONSOLE
> > > +
> > > +static int serial_base_add_one_prefcon(const char *match, const char *dev_name,
> > > + int port_id)
> > > +{
> > > + int ret;
> > > +
> > > + ret = add_preferred_console_match(match, dev_name, port_id);
> > > + if (ret == -ENOENT)
> > > + return 0;
> > > +
> > > + return ret;
> >
> > Can we do this instead?
> > return (ret == -ENOENT ? 0 : ret);
>
> No, please no.
>
> Just spell it out, like was done here, dealing with ? : is a pain to
> read and follow and the generated code should be identical.
>
> Only use ? : in places where it's the only way to do it (i.e. as
> function parameters or in printk-like lines.)
>
> Write for people first, compilers second.
Okay understood, I will keep this in mind from now on.
Thanks.
Tony,
Please feel free to take my R-by and ignore this suggestion as per
Greg's comments.
--
Best regards,
Dhruva
Powered by blists - more mailing lists