Skip to contentSkip to conversation

iio: amplifiers: ad8366: Change devm_gpiod_get() to optional and add the missed check

PATCH Markus Elfring 1 participant 1 message Jun 3, 2020 IIO

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines

Since if there is no GPIO, nothing happens, replace devm_gpiod_get() with devm_gpiod_get_optional().

…

Quoted 2 lines

+++ b/drivers/iio/amplifiers/ad8366.c

(quoted diff) +0 -0
@@ -262,8 +262,12 @@  static int ad8366_probe(struct spi_device *spi)

…

Review

Quoted 4 lines
(quoted diff) +1 -1
 	case ID_HMC1119:
-		st->reset_gpio = devm_gpiod_get(&spi->dev, "reset",
+		st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset",
 			GPIOD_OUT_HIGH);

…

I suggest to choose an other source code formatting for this statement.

A)
+ st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset",
+ GPIOD_OUT_HIGH);

B)
+ st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH);
- GPIOD_OUT_HIGH);

Regards,
Markus