Re: [PATCH] iio: trigger: iio-trig-interrupt: use devm_* helpers
From: Stepan Ionichev
Date: Mon May 11 2026 - 10:02:57 EST
On Mon, May 11, 2026 at 18:46, Andy Shevchenko wrote:
> Looking at this and taking into account the above, have you checked the
> - trigger lifetime versus platform device
> - parent-child relationship in the sysfs
>
> The latter might lead to interesting side-effects.
You are right -- the parent change is the real concern here, not
just the cleanup ladder.
Checked the rest of IIO: there are 26 other devm_iio_trigger_alloc()
callers in drivers/iio/, and all of them pass a non-NULL parent
(typically &client->dev, &spi->dev or &indio_dev->dev). The
iio-trig-interrupt driver with NULL parent is the only exception.
devm_iio_trigger_alloc() requires a non-NULL parent for devres
tracking, so the conversion necessarily introduces one. The
trigger then becomes a child of the platform device both in the
device tree and in sysfs, and its lifetime is tied to pdev
unbind instead of the (former) manual .remove().
If preserving the parent-less behavior is required for userspace
or for any subtle reason I have not thought of, please drop both
v1 and v2 of this patch. I do not have the IIO trigger framework
background to argue that the parent change is safe.
If the conversion is acceptable (in line with the rest of IIO),
v2 already addresses the dev_err()/local-device/commit-message
nits.
Stepan