Re: [PATCH v6 5/8] iio: adc: at91_adc: use local struct device pointer in probe
From: Andy Shevchenko
Date: Fri Dec 04 2026 - 04:21:23 EST
On Thu, Dec 03, 2026 at 07:30:09PM +0200, Abdelnasser Hussein wrote:
> Convert the remaining &pdev->dev and &idev->dev uses in at91_adc_probe()
> to the local dev pointer, and pass sizeof(*st) to
> devm_iio_device_alloc().
>
> Diagnostics that previously used &idev->dev now use the platform device.
Is this equivalent or not? It's unclear.
...
> if (st->caps->has_tsmr)
> - ret = devm_request_irq(&pdev->dev, st->irq,
> + ret = devm_request_irq(dev, st->irq,
> at91_adc_9x5_interrupt, 0,
> - pdev->dev.driver->name, idev);
> + dev->driver->name, idev);
> else
> - ret = devm_request_irq(&pdev->dev, st->irq,
> + ret = devm_request_irq(dev, st->irq,
> at91_adc_rl_interrupt, 0,
> - pdev->dev.driver->name, idev);
> + dev->driver->name, idev);
> if (ret)
> return ret;
Can be reshaped
if (st->caps->has_tsmr)
ret = devm_request_irq(dev, st->irq, at91_adc_9x5_interrupt, 0,
dev->driver->name, idev);
else
ret = devm_request_irq(dev, st->irq, at91_adc_rl_interrupt, 0,
dev->driver->name, idev);
if (ret)
return ret;
...
> - return dev_err_probe(&pdev->dev, -EINVAL,
> + return dev_err_probe(dev, -EINVAL,
> "No startup time available.\n");
Can be a single line now.
return dev_err_probe(dev, -EINVAL, "No startup time available.\n");
...
> ret = at91_adc_trigger_init(idev);
> if (ret < 0) {
> - dev_err(&pdev->dev, "Couldn't setup the triggers.\n");
> + dev_err(dev, "Couldn't setup the triggers.\n");
It should be dev_err_probe().
> at91_adc_buffer_remove(idev);
> return ret;
> }
...
> ret = iio_device_register(idev);
> if (ret < 0) {
> - dev_err(&pdev->dev, "Couldn't register the device.\n");
> + dev_err(dev, "Couldn't register the device.\n");
It should be dev_err_probe().
> goto error_iio_device_register;
And here is something fishy as we usually don't have goto:s in devm_*() enabled
probe. But if the order is followed, then we are okay.
> }
--
With Best Regards,
Andy Shevchenko