[PATCH v4 3/3] iio: pressure: bmp280: Use gpiod_set_value_cansleep()

Salah Triki posted 3 patches 1 month, 2 weeks ago
[PATCH v4 3/3] iio: pressure: bmp280: Use gpiod_set_value_cansleep()
Posted by Salah Triki 1 month, 2 weeks ago
Switch to `gpiod_set_value_cansleep()`, which is safe to use in
sleepable contexts like the driver probe function.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/pressure/bmp280-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index 1f0852fc3414..656f6189c84c 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -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;
 
-- 
2.43.0
Re: [PATCH v4 3/3] iio: pressure: bmp280: Use gpiod_set_value_cansleep()
Posted by Andy Shevchenko 1 month, 2 weeks ago
On Mon, Aug 18, 2025 at 10:27:32AM +0100, Salah Triki wrote:
> Switch to `gpiod_set_value_cansleep()`, which is safe to use in
> sleepable contexts like the driver probe function.

The commit message is unclear on why? aspect. You need to elaborate that some
GPIO chips may be located behind slow (and hence sleepable) busses, such as
I²C).

Code wise I agree with the change.
With amended commit message
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 3/3] iio: pressure: bmp280: Use gpiod_set_value_cansleep()
Posted by Jonathan Cameron 2 weeks, 6 days ago
On Wed, 20 Aug 2025 17:51:22 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Mon, Aug 18, 2025 at 10:27:32AM +0100, Salah Triki wrote:
> > Switch to `gpiod_set_value_cansleep()`, which is safe to use in
> > sleepable contexts like the driver probe function.  
> 
> The commit message is unclear on why? aspect. You need to elaborate that some
> GPIO chips may be located behind slow (and hence sleepable) busses, such as
> I²C).
> 
> Code wise I agree with the change.
> With amended commit message
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 

I added a brief not on slow buses and applied.

Thanks,

Jonathan