Skip to contentSkip to conversation

iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip

PATCH Applied Lars-Peter Clausen 3 participants 3 messages Mar 12, 2023 – Mar 18, 2023 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip

The ads7950 uses a mutex as well as SPI transfers in its GPIO callbacks. This means these callbacks can sleep and the can_sleep flag should be set.

Having the flag set will make sure that warnings are generated when calling any of the callbacks from a potentially non-sleeping context.

Fixes c97dce792dc8 ("iio: adc: ti-ads7950: add GPIO support")

---
Sorry if you received this twice. Forgot to cc the mailinglist on the first try.

---
 drivers/iio/adc/ti-ads7950.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/adc/ti-ads7950.c +1 -0
index 2cc9a9bd9db6..263fc3a1b87e 100644
@@ -634,6 +634,7 @@ static int ti_ads7950_probe(struct spi_device *spi)
 	st->chip.label = dev_name(&st->spi->dev);
 	st->chip.parent = &st->spi->dev;
 	st->chip.owner = THIS_MODULE;
+	st->chip.can_sleep = true;
 	st->chip.base = -1;
 	st->chip.ngpio = TI_ADS7950_NUM_GPIOS;
 	st->chip.get_direction = ti_ads7950_get_direction;
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Lars-Peter Clausen

The ads7950 uses a mutex as well as SPI transfers in its GPIO callbacks. This means these callbacks can sleep and the can_sleep flag should be set.

Having the flag set will make sure that warnings are generated when calling any of the callbacks from a potentially non-sleeping context.

Fixes c97dce792dc8 ("iio: adc: ti-ads7950: add GPIO support")

---

maintainer Applied
#2 lore raw
Quoted 5 lines · On Mon, 13 Mar 2023 13:44:33 -0500 David Lechner <[email protected]> wrote:
Quoted 4 lines · Lars-Peter Clausen

The ads7950 uses a mutex as well as SPI transfers in its GPIO callbacks. This means these callbacks can sleep and the can_sleep flag should be set.

Quoted 10 lines
Quoted 6 lines

Having the flag set will make sure that warnings are generated when calling any of the callbacks from a potentially non-sleeping context.

Fixes c97dce792dc8 ("iio: adc: ti-ads7950: add GPIO support")

---

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,
Jonathan