Re: [PATCH v2 4/4] iio: adc: ti-ads7950: complete conversion to using managed resources

From: Jonathan Cameron

Date: Mon Feb 23 2026 - 15:53:19 EST


On Sun, 22 Feb 2026 21:12:17 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

> On Fri, Feb 20, 2026 at 04:09:47PM -0800, Dmitry Torokhov wrote:
> > On Thu, Feb 19, 2026 at 09:59:35AM +0200, Andy Shevchenko wrote:
> > > On Wed, Feb 18, 2026 at 06:29:28PM -0800, Dmitry Torokhov wrote:
>
> ...
>
> > > > + if (error) {
> > > > dev_err(&spi->dev, "Error in spi setup\n");
> > > > - return ret;
> > > > + return error;
> > > > }
> > >
> > > And since there is already dev_err_probe() in use, I would expect this
> > > also be converted.
> >
> > But that would be unrelated change ;)
>
> I never told that this should be done here.
>
> ...
>
> > > Would be also nice to use
> > >
> > > struct device *dev = &spi->dev;
> > >
> > > to make less LoCs and/or make them shorter.
> >
> > I actually dislike introducing such temporaries in majority of the
> > cases. It makes it hard to follow what device we are dealing with and
> > does not make the code significantly shorter.
>
> May be, but my experience is telling me different story.
> So we have a disagreement here, I leave it to Jonathan
> to mediate.
>
When there are multiple struct device isntances that we access
in the driver I fully agree with Dmitry that it is helpful to
fully enumerate them. However, for IIO drivers we keep the
one buried in struct iio_dev fairly well hidden so the confusion
"opportunity" doesn't tend to occur. As such I tend to come down just
on the "have a local variable" side of things.

Jonathan