Re: [PATCH] iio: accel: bma180: use devm_iio_triggered_buffer_setup()

From: ShiHao

Date: Sat Mar 28 2026 - 07:19:48 EST


On Sat, Mar 21, 2026 at 01:00:18PM +0000, Jonathan Cameron wrote:

> This also changes the ordering so that the remove() path no longer
> does things in the reverse order of probe()
>
> Whilst that might not introduce bugs in this case, it makes reasoning
> about race conditions much harder so I won't take code that does this.
>
> The basic 'rule' for devm usage is that there must be only one transition
> in the probe() from using it to not using it. You should never go back
> to using it after that transition. That way the handling in remove()
> and the unwinding of the devm_* happen in reverse order of probe()
> and all is easy to reason about
>
> So to make any devm_ related changes in this driver requires a
> more comprehensive approach. Note that even if the change here didn't
> suffer this ordering problem I'd be pushing back because of the partial
> nature of applying devm in this driver. + a complete solution would
> not run into the ordering issue.

Thanks for you review. I will make sure to remember it.

Best regards
Shihao