From patchwork Fri Jun 24 21:04:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Grinberg X-Patchwork-Id: 917702 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5OL52Jc018049 for ; Fri, 24 Jun 2011 21:05:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752895Ab1FXVFB (ORCPT ); Fri, 24 Jun 2011 17:05:01 -0400 Received: from 50.23.254.54-static.reverse.softlayer.com ([50.23.254.54]:56115 "EHLO softlayer.compulab.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752753Ab1FXVFA (ORCPT ); Fri, 24 Jun 2011 17:05:00 -0400 Received: from [62.90.235.247] (port=42397 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.69) (envelope-from ) id 1QaDYe-0002jh-DY; Sat, 25 Jun 2011 00:04:56 +0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id B5D197E95CD; Sat, 25 Jun 2011 00:04:54 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WAXvcoYoRHvz; Sat, 25 Jun 2011 00:04:53 +0300 (IDT) Received: from grinberg-linux (grinberg-pc.compulab.local [10.1.1.13]) by zimbra-mta.compulab.co.il (Postfix) with SMTP id D1D277E95CB; Sat, 25 Jun 2011 00:04:52 +0300 (IDT) Received: by grinberg-linux (sSMTP sendmail emulation); Sat, 25 Jun 2011 00:04:56 +0300 From: Igor Grinberg To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Igor Grinberg Subject: [PATCH] Input: ads7846 - cleanup GPIO initialization Date: Sat, 25 Jun 2011 00:04:53 +0300 Message-Id: <1308949493-16380-1-git-send-email-grinberg@compulab.co.il> X-Mailer: git-send-email 1.7.3.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 24 Jun 2011 21:05:03 +0000 (UTC) Use gpio_request_one() instead of multiple gpiolib calls. This also simplifies error handling a bit. Signed-off-by: Igor Grinberg --- 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; }