Re: [PATCH v3 2/8] iio: temperature: ltc2983: Use local device pointer consistently

From: Andy Shevchenko

Date: Tue Jun 02 2026 - 19:20:07 EST


On Thu, May 21, 2026 at 07:42:55PM +0300, Liviu Stan wrote:
> Some functions define a local 'dev' pointer but still use bare
> '&st->spi->dev' in some code paths, and some don't have it at all.
> Replace bare references with the local pointer for consistency.

...

> - dev_dbg(&st->spi->dev, "Assign reg:0x%04X, val:0x%08X\n", reg,
> + dev_dbg(dev, "Assign reg:0x%04X, val:0x%08X\n", reg,
> chan_val);

Now it's perfectly a single line.

...

> if (chan->address >= st->num_channels) {
> - dev_err(&st->spi->dev, "Invalid chan address:%ld",
> + dev_err(dev, "Invalid chan address:%ld",
> chan->address);

Ditto.

> return -EINVAL;
> }

...

> if (ret)
> - return dev_err_probe(&st->spi->dev, ret,
> + return dev_err_probe(dev, ret,
> "Device startup timed out\n");

Ditto.

...

> - st->iio_chan = devm_kzalloc(&spi->dev,
> + st->iio_chan = devm_kzalloc(dev,
> st->iio_channels * sizeof(*st->iio_chan),
> GFP_KERNEL);

This should be first switched to devm_kcalloc().

...

> - ret = devm_request_irq(&spi->dev, spi->irq, ltc2983_irq_handler,
> + ret = devm_request_irq(dev, spi->irq, ltc2983_irq_handler,
> IRQF_TRIGGER_RISING, st->info->name, st);
> if (ret)
> - return dev_err_probe(&spi->dev, ret,
> + return dev_err_probe(dev, ret,
> "failed to request an irq\n");

Another patch should just drop this duplicate message.

...

So, this has to be split to three:
- dropping dup message
- moving to devm_kcalloc() and at the same time define local dev in the probe
(and only in the probe without changing anything else)
- this patch


--
With Best Regards,
Andy Shevchenko