Skip to contentSkip to conversation

iio: pressure: bmp280: Use gpiod_set_value_cansleep()

PATCH In review Salah Triki 2 participants 3 messages Aug 24, 2025 – Sep 13, 2025 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v5 3/3 iio: pressure: bmp280: Use gpiod_set_value_cansleep()

Replace gpiod_set_value() with gpiod_set_value_cansleep(), which is required when the GPIO controller is connected via a slow bus such as I2C. This is also safe to use in sleepable contexts like the driver probe function.

---
Changes in v5:
- Clarify commit message in patch 3/3 to better explain why gpiod_set_value_cansleep() is needed, as suggested by Andy Shevchenko.

Changes in v4:
- Split patch 2/2 into two separate patches, as suggested by Markus Elfring.

Changes in v3:
- Split into two separate patches, as suggested by Andy Shevchenko.
- Improve the error message to "failed to get reset GPIO", as suggested by David Lechner.
- Add Fixes and Cc tags where appropriate, as suggested by Markus Elfring.

Changes in v2:
- Use IS_ERR() instead of IS_ERR_OR_NULL()
- Drop dev_info()
- Use gpiod_set_value_cansleep()
- Improve commit title and message

 drivers/iio/pressure/bmp280-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +1 -1
index 1f0852fc3414..656f6189c84c 100644
@@ -3217,7 +3217,7 @@ int bmp280_common_probe(struct device *dev,
 		return dev_err_probe(dev, PTR_ERR(gpiod), "failed to get reset GPIO\n");
 
 	/* Deassert the signal */
-	gpiod_set_value(gpiod, 0);
+	gpiod_set_value_cansleep(gpiod, 0);
 
 	data->regmap = regmap;
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 8 lines · On Sun, 24 Aug 2025 13:06:09 +0100 Salah Triki <[email protected]> wrote:

Replace gpiod_set_value() with gpiod_set_value_cansleep(), which is required when the GPIO controller is connected via a slow bus such as I2C. This is also safe to use in sleepable contexts like the driver probe function.

dropped my editted v3 and picked this up.

Please don't send parts of patch series and if a patch has already being replied, it is fine for the numbering in a later version to update to reflect that. Anyhow not a problem this time as I think I have all the right patches.

Jonathan

Quoted 38 lines

---
Changes in v5:
- Clarify commit message in patch 3/3 to better explain why gpiod_set_value_cansleep() is needed, as suggested by Andy Shevchenko.

Changes in v4:
- Split patch 2/2 into two separate patches, as suggested by Markus Elfring.

Changes in v3:
- Split into two separate patches, as suggested by Andy Shevchenko.
- Improve the error message to "failed to get reset GPIO", as suggested by David Lechner.
- Add Fixes and Cc tags where appropriate, as suggested by Markus Elfring.

Changes in v2:
- Use IS_ERR() instead of IS_ERR_OR_NULL()
- Drop dev_info()
- Use gpiod_set_value_cansleep()
- Improve commit title and message

 drivers/iio/pressure/bmp280-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +1 -1
index 1f0852fc3414..656f6189c84c 100644
@@ -3217,7 +3217,7 @@ int bmp280_common_probe(struct device *dev,
 		return dev_err_probe(dev, PTR_ERR(gpiod), "failed to get reset GPIO\n");
 
 	/* Deassert the signal */
-	gpiod_set_value(gpiod, 0);
+	gpiod_set_value_cansleep(gpiod, 0);
 
 	data->regmap = regmap;
 
maintainer
#2 lore raw
In reply to Salah Triki
Quoted 9 lines · On Sun, 24 Aug 2025 13:06:09 +0100 Salah Triki <[email protected]> wrote:

Replace gpiod_set_value() with gpiod_set_value_cansleep(), which is required when the GPIO controller is connected via a slow bus such as I2C. This is also safe to use in sleepable contexts like the driver probe function.

---

Don't worry about keeping the number of patches consistent if some are already applied. However, I'm not sure where the previous patch 2 has gone...

Jonathan

Quoted 37 lines

Changes in v5:
- Clarify commit message in patch 3/3 to better explain why gpiod_set_value_cansleep() is needed, as suggested by Andy Shevchenko.

Changes in v4:
- Split patch 2/2 into two separate patches, as suggested by Markus Elfring.

Changes in v3:
- Split into two separate patches, as suggested by Andy Shevchenko.
- Improve the error message to "failed to get reset GPIO", as suggested by David Lechner.
- Add Fixes and Cc tags where appropriate, as suggested by Markus Elfring.

Changes in v2:
- Use IS_ERR() instead of IS_ERR_OR_NULL()
- Drop dev_info()
- Use gpiod_set_value_cansleep()
- Improve commit title and message

 drivers/iio/pressure/bmp280-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +1 -1
index 1f0852fc3414..656f6189c84c 100644
@@ -3217,7 +3217,7 @@ int bmp280_common_probe(struct device *dev,
 		return dev_err_probe(dev, PTR_ERR(gpiod), "failed to get reset GPIO\n");
 
 	/* Deassert the signal */
-	gpiod_set_value(gpiod, 0);
+	gpiod_set_value_cansleep(gpiod, 0);
 
 	data->regmap = regmap;