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 9402a0bfcf49f3fb0fcc7b25108a23c841dc7bb6..edef2ea1aa739860b0a00f536a3df6d8001a33db 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 be8a06666ff882c076fc6c5f230c749c50156308..0fc1b2575f454c20a7454ddf128797bca7c94520 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 43ee5b71314d4956aebf7444537129d02e8bf2d0..54004296a890c01b52a91d31f7a14c7f1ae91efe 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 b6ea462c12be6f6559b2ece50fcd11c4cf11e6f4..152be9a538ba51370c8550901c40dc7566a5a7cf 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);