diff options
author | Igor Grinberg <grinberg@compulab.co.il> | 2011-06-27 16:06:27 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-06-27 16:08:05 -0400 |
commit | 58c244009ef6ca450f0d787828a7f2f27651db5b (patch) | |
tree | 743d3f6a63fc4ddab9b09c2ccf559e65ada1ba75 /drivers | |
parent | 11d0cf8859451d6336959204b2d4cc173dd1aa4e (diff) |
Input: ads7846 - cleanup GPIO initialization
Use gpio_request_one() instead of multiple gpiolib calls.
This also simplifies error handling a bit.
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r-- | 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 5196861b86ef..d507b9b67806 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 | |||
967 | ts->get_pendown_state = pdata->get_pendown_state; | 967 | ts->get_pendown_state = pdata->get_pendown_state; |
968 | } else if (gpio_is_valid(pdata->gpio_pendown)) { | 968 | } else if (gpio_is_valid(pdata->gpio_pendown)) { |
969 | 969 | ||
970 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); | 970 | err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN, |
971 | "ads7846_pendown"); | ||
971 | if (err) { | 972 | if (err) { |
972 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", | 973 | dev_err(&spi->dev, |
973 | pdata->gpio_pendown); | 974 | "failed to request/setup pendown GPIO%d: %d\n", |
974 | return err; | 975 | pdata->gpio_pendown, err); |
975 | } | ||
976 | err = gpio_direction_input(pdata->gpio_pendown); | ||
977 | if (err) { | ||
978 | dev_err(&spi->dev, "failed to setup pendown GPIO%d\n", | ||
979 | pdata->gpio_pendown); | ||
980 | gpio_free(pdata->gpio_pendown); | ||
981 | return err; | 976 | return err; |
982 | } | 977 | } |
983 | 978 | ||