Re: [PATCH v7 09/10] iio: pressure: dps310: implement .hwfifo_flush_to_buffer()
From: Jonathan Cameron
Date: Mon Sep 21 2026 - 19:54:17 EST
On Mon, 21 Sep 2026 21:31:06 +0300
Rupesh Majhi <zoone.rupert@xxxxxxxxx> wrote:
> On Sun, 20 Sep 2026 19:32:13 +0100
> Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> > As talked abotu above, I think iio_device_claim_buffer_mode()
> > will do the job here as it stops the IIO core transitioning between
> > modes until afte this is done with the active_scan_mask.
>
> It does, but patch 10 then warns on it:
>
> dps310.c:1233:2: warning: releasing mutex 'iio' that was not held
> [-Wthread-safety-analysis]
>
> clang 23.1.2, CONFIG_WARN_CONTEXT_ANALYSIS=y. There is a
> DEFINE_GUARD_COND for direct mode but none for buffer mode, so clang
> cannot follow the conditional claim. v8 holds the same lock over the
> same span with IIO_DEV_GUARD_CURRENT_MODE() and the mode check that was
> already there. If you would rather have the named API, say so and I
> will add the buffer mode guard and ACQUIRE macro to the core first.
Adding the guard is fine - we kicked that back a while ago simply
due to lack of users. Is there a path to annotating the non
ACQUIRE.. functions to expose the right information to clang?
I did similar for sparse and at least the direct_mode claims
a while back. This might be a case of it just gets too complex
though and the compiler fails to figure out what is wrong.
Jonathan
>
> Rupesh