Patchwork [U-Boot] gpio: add gpio_is_valid() to omap_gpio API

login
register
mail settings
Submitter Nikita Kiryanov
Date Nov. 27, 2012, 9:09 a.m.
Message ID <1354007379-21956-1-git-send-email-nikita@compulab.co.il>
Download mbox | patch
Permalink /patch/202130/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Nikita Kiryanov - Nov. 27, 2012, 9:09 a.m.
Add gpio_is_valid() to omap_gpio API

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
 arch/arm/include/asm/omap_gpio.h |    8 ++++++++
 drivers/gpio/omap_gpio.c         |    4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Patch

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;
 	}