gpio: unuse pin in gpio handle 09/160509/1
authorSegwon <segwon.han@samsung.com>
Thu, 16 Nov 2017 11:24:21 +0000 (20:24 +0900)
committerSegwon <segwon.han@samsung.com>
Thu, 16 Nov 2017 11:24:21 +0000 (20:24 +0900)
Change-Id: I13df7070d2647a36752d46966bdb2fc71a2facfe
Signed-off-by: Segwon <segwon.han@samsung.com>
include/gdbus/peripheral_gdbus_gpio.h
include/peripheral_handle.h
src/gdbus/peripheral_gdbus_gpio.c
src/peripheral_gpio.c

index 9402a0b..edef2ea 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "peripheral_gdbus_common.h"
 
-int peripheral_gdbus_gpio_open(peripheral_gpio_h gpio);
+int peripheral_gdbus_gpio_open(peripheral_gpio_h gpio, int pin);
 int peripheral_gdbus_gpio_close(void);
 
 #endif /* __PERIPHERAL_GDBUS_GPIO_H__ */
index be8a066..0fc1b25 100644 (file)
@@ -21,7 +21,6 @@
  * @brief Internal struct for gpio context
  */
 struct _peripheral_gpio_s {
-       int pin;
        uint handle;
        int fd_direction;
        int fd_edge;
index 43ee5b7..5400429 100644 (file)
@@ -63,7 +63,7 @@ static int __gpio_proxy_deinit(void)
        return PERIPHERAL_ERROR_NONE;
 }
 
-int peripheral_gdbus_gpio_open(peripheral_gpio_h gpio)
+int peripheral_gdbus_gpio_open(peripheral_gpio_h gpio, int pin)
 {
        int ret;
        GError *error = NULL;
@@ -75,7 +75,7 @@ int peripheral_gdbus_gpio_open(peripheral_gpio_h gpio)
 
        if (peripheral_io_gdbus_gpio_call_open_sync(
                        gpio_proxy,
-                       gpio->pin,
+                       pin,
                        NULL,
                        &gpio->handle,
                        &ret,
index b6ea462..152be9a 100644 (file)
@@ -58,15 +58,12 @@ int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio)
 
        /* Initialize */
        handle = (peripheral_gpio_h)calloc(1, sizeof(struct _peripheral_gpio_s));
-
        if (handle == NULL) {
                _E("Failed to allocate peripheral_gpio_h");
                return PERIPHERAL_ERROR_OUT_OF_MEMORY;
        }
-       handle->pin = gpio_pin;
-
-       ret = peripheral_gdbus_gpio_open(handle);
 
+       ret = peripheral_gdbus_gpio_open(handle, gpio_pin);
        if (ret != PERIPHERAL_ERROR_NONE) {
                _E("Failed to open the gpio pin, ret : %d", ret);
                free(handle);