Skip to contentSkip to conversation

iio: adc: ad7766: Remove unneeded gpiod NULL check

PATCH In review Fabio Estevam 2 participants 2 messages Jul 16, 2017 – Jul 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: ad7766: Remove unneeded gpiod NULL check

From: Fabio Estevam <[email protected]>

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

---
 drivers/iio/adc/ad7766.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ad7766.c +2 -4
index 75cca42..ce45037 100644
@@ -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
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 6 lines · On Sun, 16 Jul 2017 18:26:03 -0300 Fabio Estevam <[email protected]> wrote:

From: Fabio Estevam <[email protected]>

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

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 28 lines
---
 drivers/iio/adc/ad7766.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ad7766.c +2 -4
index 75cca42..ce45037 100644
@@ -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