From 173b81c20665f49e02bc9d2dcb9a3db9db4c6ff9 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Wed, 23 Apr 2014 09:28:04 +0100 Subject: [PATCH] gpio.c: simplify gpio_get_valfp and make static Signed-off-by: Brendan Le Foll --- src/gpio/gpio.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/gpio/gpio.c b/src/gpio/gpio.c index dd62fac..695ecb2 100644 --- a/src/gpio/gpio.c +++ b/src/gpio/gpio.c @@ -33,8 +33,16 @@ extern "C" { #endif -int -gpio_get_valfp(gpio_t *gpio); +static int +gpio_get_valfp(gpio_t *gpio) { + char bu[64]; + sprintf(bu, "/sys/class/gpio/gpio%d/value", gpio->pin); + + if((gpio->value_fp = fopen(bu, "r+b")) == NULL) { + return 1; + } + return 0; +} void gpio_init(gpio_t *gpio, int pin) { @@ -113,19 +121,6 @@ gpio_close(gpio_t *gpio) { } } -int -gpio_get_valfp(gpio_t *gpio) { - char bu[64]; - sprintf(bu, "/sys/class/gpio/gpio%d/value", gpio->pin); - - if((gpio->value_fp = fopen(bu, "r+b")) == NULL) { - return 1; - } else { - return 0; - } - return 1; -} - #ifdef __cplusplus } #endif