* [PATCH 0/3] iio: pressure: abp060mg: Fix scale typo and I2C read handling
@ 2026-11-20 7:11 Oscar Alejandro Sánchez Lucero
2026-11-20 7:11 ` [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg Oscar Alejandro Sánchez Lucero
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-11-20 7:11 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski
Cc: linux-iio, Oscar Alejandro Sánchez Lucero
This series addresses three minor issues in the Honeywell ABP pressure
sensor driver (abp060mg):
- Fix a typo in the maximum pressure value for the abp001pg variant
(6985 Pa -> 6895 Pa).
- Validate the byte counts returned by i2c_master_send() and
i2c_master_recv() to avoid parsing uninitialized stack data on short
transfers.
- Replace msleep_interruptible() with msleep() so signals do not cut
the 40 ms sensor conversion delay short.
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
Oscar Alejandro Sánchez Lucero (3):
iio: pressure: abp060mg: Fix max pressure value for abp001pg
iio: pressure: abp060mg: Check for short I2C transfers
iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible()
drivers/iio/pressure/abp060mg.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
base-commit: adcad7f4e6332cff3d6d7165f41584899f598534
change-id: 20261120-b4-abp060mg-fixes-fa5c210392a6
Best regards,
--
Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg
2026-11-20 7:11 [PATCH 0/3] iio: pressure: abp060mg: Fix scale typo and I2C read handling Oscar Alejandro Sánchez Lucero
@ 2026-11-20 7:11 ` Oscar Alejandro Sánchez Lucero
2026-11-20 9:49 ` Andy Shevchenko
2026-11-20 7:11 ` [PATCH 2/3] iio: pressure: abp060mg: Check for short I2C transfers Oscar Alejandro Sánchez Lucero
2026-11-20 7:11 ` [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible() Oscar Alejandro Sánchez Lucero
2 siblings, 1 reply; 8+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-11-20 7:11 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski
Cc: linux-iio, Oscar Alejandro Sánchez Lucero
1 psi is approximately 6895 Pa, as stated in the comment and used in
the differential variant ABP001PD. Fix the transposed digits
(6985 -> 6895) in the ABP001PG configuration entry so its scale is
calculated properly.
Fixes: 9ecca12edde4 ("iio: pressure: Add driver for Honeywell ABP family")
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
drivers/iio/pressure/abp060mg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/pressure/abp060mg.c b/drivers/iio/pressure/abp060mg.c
index fd48bed35088..9a9dc2bfdd40 100644
--- a/drivers/iio/pressure/abp060mg.c
+++ b/drivers/iio/pressure/abp060mg.c
@@ -60,7 +60,7 @@ static const struct abp_config abp_config[] = {
[ABP250KD] = { .min = -250000, .max = 250000 },
[ABP400KD] = { .min = -400000, .max = 400000 },
/* psi variants (1 psi ~ 6895 Pa) */
- [ABP001PG] = { .min = 0, .max = 6985 },
+ [ABP001PG] = { .min = 0, .max = 6895 },
[ABP005PG] = { .min = 0, .max = 34474 },
[ABP015PG] = { .min = 0, .max = 103421 },
[ABP030PG] = { .min = 0, .max = 206843 },
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] iio: pressure: abp060mg: Check for short I2C transfers
2026-11-20 7:11 [PATCH 0/3] iio: pressure: abp060mg: Fix scale typo and I2C read handling Oscar Alejandro Sánchez Lucero
2026-11-20 7:11 ` [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg Oscar Alejandro Sánchez Lucero
@ 2026-11-20 7:11 ` Oscar Alejandro Sánchez Lucero
2026-11-20 9:49 ` Andy Shevchenko
2026-11-20 7:11 ` [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible() Oscar Alejandro Sánchez Lucero
2 siblings, 1 reply; 8+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-11-20 7:11 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski
Cc: linux-iio, Oscar Alejandro Sánchez Lucero
i2c_master_send() and i2c_master_recv() return the number of
transferred bytes or a negative error code. If a short transfer occurs
without a negative error, the driver currently proceeds to parse
uninitialized stack data from buf.
Check that the returned byte count matches the requested length and
return -EIO otherwise.
Fixes: 9ecca12edde4 ("iio: pressure: Add driver for Honeywell ABP family")
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
drivers/iio/pressure/abp060mg.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/iio/pressure/abp060mg.c b/drivers/iio/pressure/abp060mg.c
index 9a9dc2bfdd40..895deaf24427 100644
--- a/drivers/iio/pressure/abp060mg.c
+++ b/drivers/iio/pressure/abp060mg.c
@@ -108,12 +108,16 @@ static int abp060mg_get_measurement(struct abp_state *state, int *val)
ret = i2c_master_send(client, (u8 *)&buf, state->mreq_len);
if (ret < 0)
return ret;
+ if (ret != state->mreq_len)
+ return -EIO;
msleep_interruptible(ABP060MG_RESP_TIME_MS);
ret = i2c_master_recv(client, (u8 *)&buf, sizeof(buf));
if (ret < 0)
return ret;
+ if (ret != sizeof(buf))
+ return -EIO;
pressure = be16_to_cpu(buf[0]);
if (pressure & ABP060MG_ERROR_MASK)
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible()
2026-11-20 7:11 [PATCH 0/3] iio: pressure: abp060mg: Fix scale typo and I2C read handling Oscar Alejandro Sánchez Lucero
2026-11-20 7:11 ` [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg Oscar Alejandro Sánchez Lucero
2026-11-20 7:11 ` [PATCH 2/3] iio: pressure: abp060mg: Check for short I2C transfers Oscar Alejandro Sánchez Lucero
@ 2026-11-20 7:11 ` Oscar Alejandro Sánchez Lucero
2026-11-20 9:54 ` Andy Shevchenko
2 siblings, 1 reply; 8+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-11-20 7:11 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski
Cc: linux-iio, Oscar Alejandro Sánchez Lucero
The return value of msleep_interruptible() is ignored. If a signal
arrives while waiting for the sensor conversion, the thread wakes up
early and reads the sensor before the 40 ms response time has elapsed,
resulting in stale data or an -EIO error.
Use msleep() to ensure the full conversion delay is respected.
Fixes: 9ecca12edde4 ("iio: pressure: Add driver for Honeywell ABP family")
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
drivers/iio/pressure/abp060mg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/pressure/abp060mg.c b/drivers/iio/pressure/abp060mg.c
index 895deaf24427..a525dd21986b 100644
--- a/drivers/iio/pressure/abp060mg.c
+++ b/drivers/iio/pressure/abp060mg.c
@@ -111,7 +111,7 @@ static int abp060mg_get_measurement(struct abp_state *state, int *val)
if (ret != state->mreq_len)
return -EIO;
- msleep_interruptible(ABP060MG_RESP_TIME_MS);
+ msleep(ABP060MG_RESP_TIME_MS);
ret = i2c_master_recv(client, (u8 *)&buf, sizeof(buf));
if (ret < 0)
--
2.56.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg
2026-11-20 7:11 ` [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg Oscar Alejandro Sánchez Lucero
@ 2026-11-20 9:49 ` Andy Shevchenko
0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-11-20 9:49 UTC (permalink / raw)
To: Oscar Alejandro Sánchez Lucero
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski, linux-iio
On Fri, Nov 20, 2026 at 01:11:37AM -0600, Oscar Alejandro Sánchez Lucero wrote:
> 1 psi is approximately 6895 Pa, as stated in the comment and used in
> the differential variant ABP001PD. Fix the transposed digits
> (6985 -> 6895) in the ABP001PG configuration entry so its scale is
> calculated properly.
No. The comment is not a good source of information, the datasheet is.
Please, make sure your commit message has a reference to datasheet that
confirms that the comment is correct.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] iio: pressure: abp060mg: Check for short I2C transfers
2026-11-20 7:11 ` [PATCH 2/3] iio: pressure: abp060mg: Check for short I2C transfers Oscar Alejandro Sánchez Lucero
@ 2026-11-20 9:49 ` Andy Shevchenko
0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-11-20 9:49 UTC (permalink / raw)
To: Oscar Alejandro Sánchez Lucero
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski, linux-iio
On Fri, Nov 20, 2026 at 01:11:38AM -0600, Oscar Alejandro Sánchez Lucero wrote:
> i2c_master_send() and i2c_master_recv() return the number of
> transferred bytes or a negative error code. If a short transfer occurs
> without a negative error, the driver currently proceeds to parse
> uninitialized stack data from buf.
>
> Check that the returned byte count matches the requested length and
> return -EIO otherwise.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible()
2026-11-20 7:11 ` [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible() Oscar Alejandro Sánchez Lucero
@ 2026-11-20 9:54 ` Andy Shevchenko
2026-11-20 10:11 ` Alejandro Lucero
0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2026-11-20 9:54 UTC (permalink / raw)
To: Oscar Alejandro Sánchez Lucero
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski, linux-iio
On Fri, Nov 20, 2026 at 01:11:39AM -0600, Oscar Alejandro Sánchez Lucero wrote:
> The return value of msleep_interruptible() is ignored. If a signal
> arrives while waiting for the sensor conversion, the thread wakes up
> early and reads the sensor before the 40 ms response time has elapsed,
> resulting in stale data or an -EIO error.
>
> Use msleep() to ensure the full conversion delay is respected.
It should clarify better why uninterruptible call is better.
Do you have any datasheet reference that states that this time has to
be at least 40 ms?
Also we have tons of the IIO drivers doing the same. Have you studied
the history to understand when it started and what the motivation was?
Perhaps it may shed a light on this.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible()
2026-11-20 9:54 ` Andy Shevchenko
@ 2026-11-20 10:11 ` Alejandro Lucero
0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Lucero @ 2026-11-20 10:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Marcin Malagowski, linux-iio
Hi Andy,
I checked the Honeywell ABP Series datasheet (Document 32305128,
Issue 2) and the sensor response time is ~0.46-1.5 ms rather than
40 ms, so the 40 ms value in the driver is just a conservative margin
from the original author. Since I do not have the hardware to verify
timing/signal behavior properly, I will drop patch 3/3 in v2 and keep
only the other two fixes (updating patch 1/2 with the datasheet
reference).
Thanks for the review!
El vie, 20 nov 2026 a la(s) 3:54 a.m., Andy Shevchenko
(andriy.shevchenko@intel.com) escribió:
>
> On Fri, Nov 20, 2026 at 01:11:39AM -0600, Oscar Alejandro Sánchez Lucero wrote:
> > The return value of msleep_interruptible() is ignored. If a signal
> > arrives while waiting for the sensor conversion, the thread wakes up
> > early and reads the sensor before the 40 ms response time has elapsed,
> > resulting in stale data or an -EIO error.
> >
> > Use msleep() to ensure the full conversion delay is respected.
>
> It should clarify better why uninterruptible call is better.
> Do you have any datasheet reference that states that this time has to
> be at least 40 ms?
>
> Also we have tons of the IIO drivers doing the same. Have you studied
> the history to understand when it started and what the motivation was?
> Perhaps it may shed a light on this.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-11-20 10:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 7:11 [PATCH 0/3] iio: pressure: abp060mg: Fix scale typo and I2C read handling Oscar Alejandro Sánchez Lucero
2026-11-20 7:11 ` [PATCH 1/3] iio: pressure: abp060mg: Fix max pressure value for abp001pg Oscar Alejandro Sánchez Lucero
2026-11-20 9:49 ` Andy Shevchenko
2026-11-20 7:11 ` [PATCH 2/3] iio: pressure: abp060mg: Check for short I2C transfers Oscar Alejandro Sánchez Lucero
2026-11-20 9:49 ` Andy Shevchenko
2026-11-20 7:11 ` [PATCH 3/3] iio: pressure: abp060mg: Use msleep() instead of msleep_interruptible() Oscar Alejandro Sánchez Lucero
2026-11-20 9:54 ` Andy Shevchenko
2026-11-20 10:11 ` Alejandro Lucero
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox