Re: [PATCH 0/8] Remove adis_initial_startup usage

From: Nuno Sá
Date: Wed Nov 02 2022 - 11:25:45 EST


On Wed, 2022-11-02 at 16:18 +0200, Ramona Bolboaca wrote:
> Remove adis_initial_startup usage due to the fact that it leads to a
> deadlock.
> The same mutex is acquired twice, without releasing it, once inside
> adis_initial_startup and once inside adis_enable_irq.
> Instead of adis_initial_startup, use __adis_initial_startup.
>

Auchhhh!!! Thanks for catching this... However, the Fixes tag is
pointing to the wrong place. I'm fairly sure I introduced this bug in 

commit b600bd7eb3335 ("iio: adis: do not disabe IRQs in 'adis_init()'")

This was where the call to adis_enable_irq() was moved to
__adis_initial_startup() and effectively creating the deadlock for some
devices (adis->data->unmasked_drdy is not set)...


I guess I did not saw this when bringing in the change because I
probably tested the full series on some device supported by adis16475.c
where this won't trigger.

>From a quick look I think it's safe to drop adis_initial_startup() as
it is always called during probe() before registering the IIO device.
We could also just create an unlocked version of adis_enable_irq()
(since we don't need to grab the lock in this path) but likely not
worth the trouble.

- Nuno Sá