[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <TY1PR01MB1769F130075F1635CC51532FF55C0@TY1PR01MB1769.jpnprd01.prod.outlook.com>
Date: Tue, 17 Jul 2018 14:40:03 +0000
From: Phil Edworthy <phil.edworthy@...esas.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Simon Horman <horms@...ge.net.au>
CC: Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>
Subject: RE: [PATCH 2/2] i2c: designware: Add support for a bus clock
Hi Andy,
On 17 July 2018 15:19, Andy Shevchenko wrote:
> On Tue, 2018-07-17 at 12:42 +0000, Phil Edworthy wrote:
>
> > > While your point sounds valid (don't remember how clk_get() is
> > > implemented), NULL is also OK to have.
> >
> > Ok as in there is no bus clock, right?
> > So it should be:
> > if (!IS_ERR_OR_NULL (dev->busclk))
>
> Nope, NULL is no error case for optional clock.
I must be missing something here...
I agree that NULL for an optional clock is not an error. However, the
code above is now:
+ if (prepare) {
+ /* Optional bus clock */
+ if (!IS_ERR_OR_NULL(dev->busclk)) {
+ ret = clk_prepare_enable(dev->busclk);
+ if (ret)
+ return ret;
+ }
+
return clk_prepare_enable(dev->clk);
+ }
So, if you have a valid busclk, it gets enabled, otherwise it is
left alone.
Thanks
Phil
Powered by blists - more mailing lists