Re: [PATCH v2] iio: pressure: dps310: don't wait for new temperature in trigger handler
From: Rupesh Majhi
Date: Tue Nov 17 2026 - 06:07:43 EST
On Tue, 17 Nov 2026 03:37:41 +0000
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> > I actually looked at what was messing up this time. It was just that
> > int rc; had been dropped. It's just used locally in this patch so I
> > put a declaration in.
On testing (d922ed738439) temperature read ended up in
dps310_fifo_interval() instead of probe. That runs with data->lock
held, so enabling the buffer without a trigger hangs on the board.
Diff below on top of testing moves it to probe, tested on the board.
Thanks,
Rupesh
diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c
index 9b52cbc2372a..ebfaa67a6b91 100644
--- a/drivers/iio/pressure/dps310.c
+++ b/drivers/iio/pressure/dps310.c
@@ -1058,16 +1058,9 @@ static unsigned int dps310_fifo_interval(struct dps310_data *data,
{
unsigned int drain_interval_ms, fill_ms, want_ms;
int scan_rate;
- int rc;
fill_ms = MSEC_PER_SEC * DPS310_FIFO_DEPTH / (prs_rate + tmp_rate);
- /* Pressure compensation needs a temperature from the start */
- scoped_guard(mutex, &data->lock)
- rc = dps310_read_temp_raw_locked(data);
- if (rc)
- return rc;
-
/*
* There is no hardware watermark, so take it as the number of scans
* the user will wait for and drain at that rate. Scans come from
@@ -1478,6 +1471,12 @@ static int dps310_probe(struct i2c_client *client)
if (rc)
return rc;
+ /* Pressure compensation needs a temperature from the start */
+ scoped_guard(mutex, &data->lock)
+ rc = dps310_read_temp_raw_locked(data);
+ if (rc)
+ return rc;
+
/*
* The device measures continuously in background mode, so a triggered
* capture is just a read of the latest results. The setup ops run the