[PATCH] Input: ads7846 - cleanup GPIO initialization

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE5543d

2 messages, 2 authors, 2011-06-28 · open the first message on its own page

[PATCH] Input: ads7846 - cleanup GPIO initialization

From: Igor Grinberg <hidden>
Date: 2011-06-24 21:05:00

Use gpio_request_one() instead of multiple gpiolib calls.
This also simplifies error handling a bit.

Signed-off-by: Igor Grinberg <redacted>
---
This has became possible thanks to Randy Dunlap
c001fb72a7b705f902bdfdd05b5d2408efe6f848 (v3.0-rc4)
(gpio: add GPIOF_ values regardless on kconfig settings)


 drivers/input/touchscreen/ads7846.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 5196861..d507b9b 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -967,17 +967,12 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 		ts->get_pendown_state = pdata->get_pendown_state;
 	} else if (gpio_is_valid(pdata->gpio_pendown)) {
 
-		err = gpio_request(pdata->gpio_pendown, "ads7846_pendown");
+		err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN,
+				       "ads7846_pendown");
 		if (err) {
-			dev_err(&spi->dev, "failed to request pendown GPIO%d\n",
-				pdata->gpio_pendown);
-			return err;
-		}
-		err = gpio_direction_input(pdata->gpio_pendown);
-		if (err) {
-			dev_err(&spi->dev, "failed to setup pendown GPIO%d\n",
-				pdata->gpio_pendown);
-			gpio_free(pdata->gpio_pendown);
+			dev_err(&spi->dev,
+				"failed to request/setup pendown GPIO%d: %d\n",
+				pdata->gpio_pendown, err);
 			return err;
 		}
 
-- 
1.7.3.4

Re: [PATCH] Input: ads7846 - cleanup GPIO initialization

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-06-28 05:54:26

Igor Grinberg [off-list ref] wrote:
Use gpio_request_one() instead of multiple gpiolib calls.
This also simplifies error handling a bit.

Signed-off-by: Igor Grinberg <redacted>
Applied, thanks Igor.


-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help