9
0
Fork 0

gpio: move gpio_is_valid to gpio.h

gpio < 0 means invalid too

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-10-27 22:22:45 +02:00 committed by Sascha Hauer
parent 5043fc33ac
commit 8a299c53bb
2 changed files with 11 additions and 9 deletions

View File

@ -4,17 +4,8 @@
static LIST_HEAD(chip_list);
#define ARCH_NR_GPIOS 256
static struct gpio_chip *gpio_desc[ARCH_NR_GPIOS];
static int gpio_is_valid(unsigned gpio)
{
if (gpio < ARCH_NR_GPIOS)
return 1;
return 0;
}
void gpio_set_value(unsigned gpio, int value)
{
struct gpio_chip *chip = gpio_desc[gpio];

View File

@ -1,6 +1,17 @@
#ifndef __ASM_GENERIC_GPIO_H
#define __ASM_GENERIC_GPIO_H
#define ARCH_NR_GPIOS 256
static inline int gpio_is_valid(int gpio)
{
if (gpio < 0)
return 0;
if (gpio < ARCH_NR_GPIOS)
return 1;
return 0;
}
void gpio_set_value(unsigned gpio, int value);
int gpio_get_value(unsigned gpio);
int gpio_direction_output(unsigned gpio, int value);