Re: [PATCH] iio: trigger: iio-trig-interrupt: use devm_* helpers
From: Stepan Ionichev
Date: Mon May 11 2026 - 09:45:44 EST
On Mon, May 11, 2026 at 15:33 +0200, Joshua Crofts wrote:
> I would say that this is a functional change, you are changing
> how resources are managed and how teardown works. (But
> maybe I'm wrong).
Fair point -- the user-visible behavior on success or on module
unload is the same, but the lifetime/ownership model changes.
I will reword that in v2 ("convert to devm-managed lifecycle"
instead of "no functional change").
> consider introducing a local struct device variable, so you
> don't have to use &pdev->dev constantly. It makes the code
> easier to read and saves space!
OK, will add `struct device *dev = &pdev->dev;` in v2.
> If I'm not mistaken, devm_request_irq automatically throws
> an error on failure, so the dev_err() call is redundant,
> just keep the return.
I do not see this in the source. devm_request_irq() in
kernel/irq/devres.c wraps request_threaded_irq() with a
devres action; neither prints on failure. The caller still
needs the error message.
In v2 I can switch from dev_err() to dev_err_probe(), which
handles -EPROBE_DEFER cleanly:
if (ret)
return dev_err_probe(dev, ret,
"request IRQ-%d failed\n", irq);
If I missed where devm_request_irq() prints, please point me
to it.
Stepan