All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip
@ 2023-03-12 21:09 Lars-Peter Clausen
  2023-03-13 18:44 ` David Lechner
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2023-03-12 21:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: David Lechner, Justin Chen, linux-iio, 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")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
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(+)

diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
index 2cc9a9bd9db6..263fc3a1b87e 100644
--- a/drivers/iio/adc/ti-ads7950.c
+++ b/drivers/iio/adc/ti-ads7950.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip
  2023-03-12 21:09 [PATCH] iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip Lars-Peter Clausen
@ 2023-03-13 18:44 ` David Lechner
  2023-03-18 16:40   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2023-03-13 18:44 UTC (permalink / raw)
  To: Lars-Peter Clausen, Jonathan Cameron; +Cc: Justin Chen, linux-iio

On 3/12/23 4:09 PM, Lars-Peter Clausen wrote:
> 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")
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---

Acked-by: David Lechner <david@lechnology.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip
  2023-03-13 18:44 ` David Lechner
@ 2023-03-18 16:40   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2023-03-18 16:40 UTC (permalink / raw)
  To: David Lechner; +Cc: Lars-Peter Clausen, Justin Chen, linux-iio

On Mon, 13 Mar 2023 13:44:33 -0500
David Lechner <david@lechnology.com> wrote:

> On 3/12/23 4:09 PM, Lars-Peter Clausen wrote:
> > 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")
> > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> > ---  
> 
> Acked-by: David Lechner <david@lechnology.com>
> 
> 

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

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-18 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-12 21:09 [PATCH] iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip Lars-Peter Clausen
2023-03-13 18:44 ` David Lechner
2023-03-18 16:40   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.