Skip to contentSkip to conversation

backlight: lms283gf05: use devm_gpio_request_one

PATCH In review Jingoo Han 2 participants 2 messages Oct 17, 2012

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/2 backlight: lms283gf05: use devm_gpio_request_one

By using devm_gpio_request_one it is possible to set the direction and initial value in one shot. Thus, using devm_gpio_request_one can make the code simpler.

Cc Richard Purdie <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/video/backlight/lms283gf05.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
drivers/video/backlight/lms283gf05.c +3 -7
index ea43f22..c452210 100644
@@ -158,13 +158,9 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
 	int ret = 0;
 
 	if (pdata != NULL) {
-		ret = devm_gpio_request(&spi->dev, pdata->reset_gpio,
-					"LMS285GF05 RESET");
-		if (ret)
-			return ret;
-
-		ret = gpio_direction_output(pdata->reset_gpio,
-						!pdata->reset_inverted);
+		ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
+				GPIOF_DIR_OUT | !pdata->reset_inverted,
+				"LMS285GF05 RESET");
 		if (ret)
 			return ret;
 	}
Signature · 1 line
1.7.1
Acked-by on v1 1/2
#1 lore raw

Dear Jingoo Han,

Quoted 7 lines

By using devm_gpio_request_one it is possible to set the direction and initial value in one shot. Thus, using devm_gpio_request_one can make the code simpler.

Cc Richard Purdie <[email protected]>
Cc Marek Vasut <[email protected]>
Quoted 15 lines
---
 drivers/video/backlight/lms283gf05.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/video/backlight/lms283gf05.c index ea43f22..c452210 100644

drivers/video/backlight/lms283gf05.c +0 -3
@@ -158,13 +158,9 @@ static int __devinit lms283gf05_probe(struct
 spi_device *spi) int ret = 0;
 
 	if (pdata != NULL) {
-		ret = devm_gpio_request(&spi->dev, pdata->reset_gpio,
-					"LMS285GF05 RESET");
-		if (ret)

drivers/video/backlight/lms283gf05.c static int __devinit lms283gf05_probe(struct · line 166

Quoted 10 lines
drivers/video/backlight/lms283gf05.c +3 -4
-			return ret;
-
-		ret = gpio_direction_output(pdata->reset_gpio,
-						!pdata->reset_inverted);
+		ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
+				GPIOF_DIR_OUT | !pdata->reset_inverted,
+				"LMS285GF05 RESET");
 		if (ret)
 			return ret;
 	}

Best regards,
Marek Vasut