Re: [PATCH v2 4/4] iio: adc: ti-ads7950: complete conversion to using managed resources
From: Dmitry Torokhov
Date: Fri Feb 20 2026 - 19:10:01 EST
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:
> > All resources that the driver needs have managed API now. Switch to
> > using them to make code clearer and drop ti_ads7950_remove().
>
> ...
>
> > static int ti_ads7950_probe(struct spi_device *spi)
> > {
> > struct ti_ads7950_state *st;
> > struct iio_dev *indio_dev;
> > const struct ti_ads7950_chip_info *info;
> > - int ret;
> > + int error;
>
> Unrelated change.
>
> ...
>
> > spi->bits_per_word = 16;
> > spi->mode |= SPI_CS_WORD;
> > - ret = spi_setup(spi);
> > - if (ret < 0) {
> > + error = spi_setup(spi);
> > + if (error) {
> > dev_err(&spi->dev, "Error in spi setup\n");
> > - return ret;
> > + return error;
> > }
>
> Ditto.
>
> And since there is already dev_err_probe() in use, I would expect this
> also be converted.
But that would be unrelated change ;)
>
> 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.
Thanks.
--
Dmitry