RE: [PATCH 2/2] i2c: designware: Add support for a bus clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

On 17 July 2018 15:47, Andy Shevchenko wrote:
> On Tue, 2018-07-17 at 14:40 +0000, Phil Edworthy wrote:
> > 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...
> 
> See how clk_prepare_enable() is implemented.
Ok, if busclk is NULL the code can safely call clk_prepare_enable()


> > 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)) {
> 
> Check for NULL is redundant.
> 
> > +			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.
> 
So the code as sent in the original email is correct (aside from Geert's
comments about EPROBE_DEFER handling).

Maybe I need some coffee :\
Thanks
Phil




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux