From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Phil Edworthy <phil.edworthy@renesas.com>,
Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Russell King <linux@armlinux.org.uk>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Greg Ungerer <gerg@linux-m68k.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Huacai Chen <chenhc@lemote.com>, Guan Xuetao <gxt@pku.edu.cn>,
linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] clk: Add (devm_)clk_get_optional() functions
Date: Tue, 20 Nov 2018 15:26:19 +0200 [thread overview]
Message-ID: <20181120132619.GY10650@smile.fi.intel.com> (raw)
In-Reply-To: <20181120125652.afk2rltmnunfo346@pengutronix.de>
On Tue, Nov 20, 2018 at 01:56:52PM +0100, Uwe Kleine-König wrote:
> On Tue, Nov 20, 2018 at 12:38:33PM +0200, Andy Shevchenko wrote:
> > On Mon, Nov 19, 2018 at 02:12:59PM +0000, Phil Edworthy wrote:
> > > + if (clk == ERR_PTR(-ENOENT))
> > > + return NULL;
> > > + else
> > > + return clk;
> >
> > return clk == ERR_PTR(-ENOENT) ? NULL : clk;
> >
> > ?
>
> Not sure this adds to the readability of the expression. Personally I
> prefer the explicit if. Maybe even:
>
> clk = clk_get(...);
>
> if (clk == ERR_PTR(-ENOENT))
> clk = NULL;
>
> return clk;
So, it almost repeats the initial variant.
I'm fine with no 'else' in initial code, like
if (...)
return NULL;
return clk;
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Phil Edworthy <phil.edworthy@renesas.com>,
Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Russell King <linux@armlinux.org.uk>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Greg Ungerer <gerg@linux-m68k.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Huacai Chen <chenhc@lemote.com>, Guan Xuetao <gxt@pku.edu.cn>,
linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] clk: Add (devm_)clk_get_optional() functions
Date: Tue, 20 Nov 2018 15:26:19 +0200 [thread overview]
Message-ID: <20181120132619.GY10650@smile.fi.intel.com> (raw)
In-Reply-To: <20181120125652.afk2rltmnunfo346@pengutronix.de>
On Tue, Nov 20, 2018 at 01:56:52PM +0100, Uwe Kleine-K�nig wrote:
> On Tue, Nov 20, 2018 at 12:38:33PM +0200, Andy Shevchenko wrote:
> > On Mon, Nov 19, 2018 at 02:12:59PM +0000, Phil Edworthy wrote:
> > > + if (clk == ERR_PTR(-ENOENT))
> > > + return NULL;
> > > + else
> > > + return clk;
> >
> > return clk == ERR_PTR(-ENOENT) ? NULL : clk;
> >
> > ?
>
> Not sure this adds to the readability of the expression. Personally I
> prefer the explicit if. Maybe even:
>
> clk = clk_get(...);
>
> if (clk == ERR_PTR(-ENOENT))
> clk = NULL;
>
> return clk;
So, it almost repeats the initial variant.
I'm fine with no 'else' in initial code, like
if (...)
return NULL;
return clk;
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: Add (devm_)clk_get_optional() functions
Date: Tue, 20 Nov 2018 15:26:19 +0200 [thread overview]
Message-ID: <20181120132619.GY10650@smile.fi.intel.com> (raw)
In-Reply-To: <20181120125652.afk2rltmnunfo346@pengutronix.de>
On Tue, Nov 20, 2018 at 01:56:52PM +0100, Uwe Kleine-K?nig wrote:
> On Tue, Nov 20, 2018 at 12:38:33PM +0200, Andy Shevchenko wrote:
> > On Mon, Nov 19, 2018 at 02:12:59PM +0000, Phil Edworthy wrote:
> > > + if (clk == ERR_PTR(-ENOENT))
> > > + return NULL;
> > > + else
> > > + return clk;
> >
> > return clk == ERR_PTR(-ENOENT) ? NULL : clk;
> >
> > ?
>
> Not sure this adds to the readability of the expression. Personally I
> prefer the explicit if. Maybe even:
>
> clk = clk_get(...);
>
> if (clk == ERR_PTR(-ENOENT))
> clk = NULL;
>
> return clk;
So, it almost repeats the initial variant.
I'm fine with no 'else' in initial code, like
if (...)
return NULL;
return clk;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2018-11-20 13:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 14:12 [PATCH] clk: Add (devm_)clk_get_optional() functions Phil Edworthy
2018-11-19 14:12 ` Phil Edworthy
2018-11-20 10:38 ` Andy Shevchenko
2018-11-20 10:38 ` Andy Shevchenko
2018-11-20 10:53 ` Phil Edworthy
2018-11-20 10:53 ` Phil Edworthy
2018-11-20 11:12 ` Andy Shevchenko
2018-11-20 11:12 ` Andy Shevchenko
2018-11-20 12:56 ` Uwe Kleine-König
2018-11-20 12:56 ` Uwe Kleine-König
2018-11-20 12:56 ` Uwe Kleine-König
2018-11-20 13:26 ` Andy Shevchenko [this message]
2018-11-20 13:26 ` Andy Shevchenko
2018-11-20 13:26 ` Andy Shevchenko
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=20181120132619.GY10650@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=chenhc@lemote.com \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=gxt@pku.edu.cn \
--cc=jhogan@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mturquette@baylibre.com \
--cc=paul.burton@mips.com \
--cc=phil.edworthy@renesas.com \
--cc=ralf@linux-mips.org \
--cc=sboyd@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.