public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()
@ 2024-11-22 16:43 Fabio Estevam
  2024-12-01 13:03 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2024-11-22 16:43 UTC (permalink / raw)
  To: jic23; +Cc: lars, dmurphy, linux-iio, linux-kernel, Fabio Estevam, stable

Using gpiod_set_value() to control the reset GPIO causes some verbose
warnings during boot when the reset GPIO is controlled by an I2C IO
expander.

As the caller can sleep, use the gpiod_set_value_cansleep() variant to
fix the issue.

Tested on a custom i.MX93 board with a ADS124S08 ADC.

Cc: <stable@kernel.org>
Fixes: e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/iio/adc/ti-ads124s08.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
index 425b48d8986f..f452f57f11c9 100644
--- a/drivers/iio/adc/ti-ads124s08.c
+++ b/drivers/iio/adc/ti-ads124s08.c
@@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
 	struct ads124s_private *priv = iio_priv(indio_dev);
 
 	if (priv->reset_gpio) {
-		gpiod_set_value(priv->reset_gpio, 0);
+		gpiod_set_value_cansleep(priv->reset_gpio, 0);
 		udelay(200);
-		gpiod_set_value(priv->reset_gpio, 1);
+		gpiod_set_value_cansleep(priv->reset_gpio, 1);
 	} else {
 		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
 	}
-- 
2.34.1


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

* Re: [PATCH] iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()
  2024-11-22 16:43 [PATCH] iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep() Fabio Estevam
@ 2024-12-01 13:03 ` Jonathan Cameron
  2024-12-07 18:34   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2024-12-01 13:03 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: lars, dmurphy, linux-iio, linux-kernel, stable

On Fri, 22 Nov 2024 13:43:08 -0300
Fabio Estevam <festevam@gmail.com> wrote:

> Using gpiod_set_value() to control the reset GPIO causes some verbose
> warnings during boot when the reset GPIO is controlled by an I2C IO
> expander.
> 
> As the caller can sleep, use the gpiod_set_value_cansleep() variant to
> fix the issue.
> 
> Tested on a custom i.MX93 board with a ADS124S08 ADC.
> 
> Cc: <stable@kernel.org>
> Fixes: e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
Hmm. Could be considered a feature, but fair enough as the change is
trivial and you are setting it on a real board.

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ti-ads124s08.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
> index 425b48d8986f..f452f57f11c9 100644
> --- a/drivers/iio/adc/ti-ads124s08.c
> +++ b/drivers/iio/adc/ti-ads124s08.c
> @@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
>  	struct ads124s_private *priv = iio_priv(indio_dev);
>  
>  	if (priv->reset_gpio) {
> -		gpiod_set_value(priv->reset_gpio, 0);
> +		gpiod_set_value_cansleep(priv->reset_gpio, 0);
>  		udelay(200);
> -		gpiod_set_value(priv->reset_gpio, 1);
> +		gpiod_set_value_cansleep(priv->reset_gpio, 1);
>  	} else {
>  		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
>  	}


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

* Re: [PATCH] iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()
  2024-12-01 13:03 ` Jonathan Cameron
@ 2024-12-07 18:34   ` Andy Shevchenko
  2024-12-08 18:33     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2024-12-07 18:34 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Fabio Estevam, lars, dmurphy, linux-iio, linux-kernel, stable

On Sun, Dec 01, 2024 at 01:03:56PM +0000, Jonathan Cameron wrote:
> On Fri, 22 Nov 2024 13:43:08 -0300
> Fabio Estevam <festevam@gmail.com> wrote:
> > Using gpiod_set_value() to control the reset GPIO causes some verbose
> > warnings during boot when the reset GPIO is controlled by an I2C IO
> > expander.
> > 
> > As the caller can sleep, use the gpiod_set_value_cansleep() variant to
> > fix the issue.
> > 
> > Tested on a custom i.MX93 board with a ADS124S08 ADC.

> Hmm. Could be considered a feature, but fair enough as the change is
> trivial and you are setting it on a real board.
> 
> Applied to the fixes-togreg branch of iio.git.

...

> > @@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
> >  	struct ads124s_private *priv = iio_priv(indio_dev);
> >  
> >  	if (priv->reset_gpio) {
> > -		gpiod_set_value(priv->reset_gpio, 0);
> > +		gpiod_set_value_cansleep(priv->reset_gpio, 0);
> >  		udelay(200);

Obviously if you allow that change, you should switch to fsleep() here.

> > -		gpiod_set_value(priv->reset_gpio, 1);
> > +		gpiod_set_value_cansleep(priv->reset_gpio, 1);
> >  	} else {
> >  		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
> >  	}

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()
  2024-12-07 18:34   ` Andy Shevchenko
@ 2024-12-08 18:33     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2024-12-08 18:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Fabio Estevam, lars, dmurphy, linux-iio, linux-kernel, stable

On Sat, 7 Dec 2024 20:34:30 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Sun, Dec 01, 2024 at 01:03:56PM +0000, Jonathan Cameron wrote:
> > On Fri, 22 Nov 2024 13:43:08 -0300
> > Fabio Estevam <festevam@gmail.com> wrote:  
> > > Using gpiod_set_value() to control the reset GPIO causes some verbose
> > > warnings during boot when the reset GPIO is controlled by an I2C IO
> > > expander.
> > > 
> > > As the caller can sleep, use the gpiod_set_value_cansleep() variant to
> > > fix the issue.
> > > 
> > > Tested on a custom i.MX93 board with a ADS124S08 ADC.  
> 
> > Hmm. Could be considered a feature, but fair enough as the change is
> > trivial and you are setting it on a real board.
> > 
> > Applied to the fixes-togreg branch of iio.git.  
> 
> ...
> 
> > > @@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
> > >  	struct ads124s_private *priv = iio_priv(indio_dev);
> > >  
> > >  	if (priv->reset_gpio) {
> > > -		gpiod_set_value(priv->reset_gpio, 0);
> > > +		gpiod_set_value_cansleep(priv->reset_gpio, 0);
> > >  		udelay(200);  
> 
> Obviously if you allow that change, you should switch to fsleep() here.
True, that would be a nice follow up tidying up.

Jonathan

> 
> > > -		gpiod_set_value(priv->reset_gpio, 1);
> > > +		gpiod_set_value_cansleep(priv->reset_gpio, 1);
> > >  	} else {
> > >  		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
> > >  	}  
> 


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

end of thread, other threads:[~2024-12-08 18:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-22 16:43 [PATCH] iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep() Fabio Estevam
2024-12-01 13:03 ` Jonathan Cameron
2024-12-07 18:34   ` Andy Shevchenko
2024-12-08 18:33     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox