Re: [PATCH v7 4/4] iio: adc: ad7192: Add clock provider

From: Jonathan Cameron
Date: Sat Jul 20 2024 - 09:44:45 EST


On Thu, 18 Jul 2024 16:11:29 +0200
Nuno Sá <noname.nuno@xxxxxxxxx> wrote:

> On Thu, 2024-07-18 at 00:25 +0300, Alisa-Dariana Roman wrote:
> > Internal clock of AD719X devices can be made available on MCLK2 pin. Add
> > clock provider to support this functionality when clock cells property
> > is present.
> >
> > Signed-off-by: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
> > ---
>
> minor thing below you may consider if a re-spin is needed...
>
> Reviewed-by: Nuno Sa <nuno.sa@xxxxxxxxxx>

> > +static int ad7192_register_clk_provider(struct ad7192_state *st)
> > +{
> > + struct device *dev = &st->sd.spi->dev;
> > + struct clk_init_data init = {};
> > + int ret;
> > +
> > + if (!device_property_present(dev, "#clock-cells"))
> > + return 0;
> > +
> > + if (!IS_ENABLED(CONFIG_COMMON_CLK))
> > + return 0;
> >
>
> nit: This could be the first test to do. No point in calling
> device_property_present() if CONFIG_COMMON_CLK is disabled. FWIW, the compiler should
> be smart enough to sort things out but it would still be better (for readability) to
> have this first.
>
Tweaked whilst applying.

Compiler probably can't figure it out as won't have enough visibility of the
implementation of device_property_present() to know it doesn't have side effects
deep in one of the indirect function calls that can generate.

Jonathan


> - Nuno Sá
>
>