From patchwork Tue Nov 27 09:09:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 202130 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 647B92C0081 for ; Tue, 27 Nov 2012 20:10:00 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 953874A032; Tue, 27 Nov 2012 10:09:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UxZdOBaPewdf; Tue, 27 Nov 2012 10:09:57 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C32924A02C; Tue, 27 Nov 2012 10:09:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B0B04A02C for ; Tue, 27 Nov 2012 10:09:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lip3A4pZ6cWi for ; Tue, 27 Nov 2012 10:09:51 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from compulab.co.il (softlayer.compulab.co.il [50.23.254.55]) by theia.denx.de (Postfix) with ESMTPS id A84C24A02A for ; Tue, 27 Nov 2012 10:09:51 +0100 (CET) Received: from [62.90.235.247] (port=38624 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.80) (envelope-from ) id 1TdHAo-0003mk-VY; Tue, 27 Nov 2012 11:09:47 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 175FB64419A; Tue, 27 Nov 2012 11:09:46 +0200 (IST) 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 oAL7sixlDWhQ; Tue, 27 Nov 2012 11:09:45 +0200 (IST) Received: from compulab.co.il (nikita-pc.compulab.local [192.168.11.211]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id A3C86644194; Tue, 27 Nov 2012 11:09:45 +0200 (IST) Received: by compulab.co.il (Postfix, from userid 1000) id B607EFC0198; Tue, 27 Nov 2012 11:09:45 +0200 (IST) From: Nikita Kiryanov To: u-boot@lists.denx.de Date: Tue, 27 Nov 2012 11:09:39 +0200 Message-Id: <1354007379-21956-1-git-send-email-nikita@compulab.co.il> X-Mailer: git-send-email 1.7.10.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 - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_relayhosts_text_entry: nikita@compulab.co.il|compulab.co.il Cc: trini@ti.com Subject: [U-Boot] [PATCH] gpio: add gpio_is_valid() to omap_gpio API X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add gpio_is_valid() to omap_gpio API Signed-off-by: Nikita Kiryanov --- arch/arm/include/asm/omap_gpio.h | 8 ++++++++ drivers/gpio/omap_gpio.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/omap_gpio.h b/arch/arm/include/asm/omap_gpio.h index 516cc42..be94770 100644 --- a/arch/arm/include/asm/omap_gpio.h +++ b/arch/arm/include/asm/omap_gpio.h @@ -49,4 +49,12 @@ extern const struct gpio_bank *const omap_gpio_bank; #define METHOD_GPIO_24XX 4 +/** + * Check if gpio is valid. + * + * @param gpio GPIO number + * @return 0 if ok, -1 on error + */ +int gpio_is_valid(int gpio); + #endif /* _GPIO_H_ */ diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index fc89f2a..6e5b5f7 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -53,7 +53,7 @@ static inline int get_gpio_index(int gpio) return gpio & 0x1f; } -static inline int gpio_valid(int gpio) +int gpio_is_valid(int gpio) { if (gpio < 0) return -1; @@ -64,7 +64,7 @@ static inline int gpio_valid(int gpio) static int check_gpio(int gpio) { - if (gpio_valid(gpio) < 0) { + if (gpio_is_valid(gpio) < 0) { printf("ERROR : check_gpio: invalid GPIO %d\n", gpio); return -1; }