linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7766: Remove unneeded gpiod NULL check
@ 2017-07-16 21:26 Fabio Estevam
  2017-07-17 20:48 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2017-07-16 21:26 UTC (permalink / raw)
  To: jic23; +Cc: lars, linux-iio, Fabio Estevam

From: Fabio Estevam <fabio.estevam@nxp.com>

The gpiod API checks for NULL descriptors, so there is no need to
duplicate the check in the driver.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/iio/adc/ad7766.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ad7766.c b/drivers/iio/adc/ad7766.c
index 75cca42..ce45037 100644
--- a/drivers/iio/adc/ad7766.c
+++ b/drivers/iio/adc/ad7766.c
@@ -103,8 +103,7 @@ static int ad7766_preenable(struct iio_dev *indio_dev)
 		return ret;
 	}
 
-	if (ad7766->pd_gpio)
-		gpiod_set_value(ad7766->pd_gpio, 0);
+	gpiod_set_value(ad7766->pd_gpio, 0);
 
 	return 0;
 }
@@ -113,8 +112,7 @@ static int ad7766_postdisable(struct iio_dev *indio_dev)
 {
 	struct ad7766 *ad7766 = iio_priv(indio_dev);
 
-	if (ad7766->pd_gpio)
-		gpiod_set_value(ad7766->pd_gpio, 1);
+	gpiod_set_value(ad7766->pd_gpio, 1);
 
 	/*
 	 * The PD pin is synchronous to the clock, so give it some time to
-- 
2.7.4

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

* Re: [PATCH] iio: adc: ad7766: Remove unneeded gpiod NULL check
  2017-07-16 21:26 [PATCH] iio: adc: ad7766: Remove unneeded gpiod NULL check Fabio Estevam
@ 2017-07-17 20:48 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2017-07-17 20:48 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: lars, linux-iio, Fabio Estevam

On Sun, 16 Jul 2017 18:26:03 -0300
Fabio Estevam <festevam@gmail.com> wrote:

> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> The gpiod API checks for NULL descriptors, so there is no need to
> duplicate the check in the driver.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/ad7766.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7766.c b/drivers/iio/adc/ad7766.c
> index 75cca42..ce45037 100644
> --- a/drivers/iio/adc/ad7766.c
> +++ b/drivers/iio/adc/ad7766.c
> @@ -103,8 +103,7 @@ static int ad7766_preenable(struct iio_dev *indio_dev)
>  		return ret;
>  	}
>  
> -	if (ad7766->pd_gpio)
> -		gpiod_set_value(ad7766->pd_gpio, 0);
> +	gpiod_set_value(ad7766->pd_gpio, 0);
>  
>  	return 0;
>  }
> @@ -113,8 +112,7 @@ static int ad7766_postdisable(struct iio_dev *indio_dev)
>  {
>  	struct ad7766 *ad7766 = iio_priv(indio_dev);
>  
> -	if (ad7766->pd_gpio)
> -		gpiod_set_value(ad7766->pd_gpio, 1);
> +	gpiod_set_value(ad7766->pd_gpio, 1);
>  
>  	/*
>  	 * The PD pin is synchronous to the clock, so give it some time to


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

end of thread, other threads:[~2017-07-17 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-16 21:26 [PATCH] iio: adc: ad7766: Remove unneeded gpiod NULL check Fabio Estevam
2017-07-17 20:48 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).