From: Segwon Date: Thu, 16 Nov 2017 11:24:21 +0000 (+0900) Subject: gpio: unuse pin in gpio handle X-Git-Tag: submit/tizen_4.0/20171220.125806^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ceca2c8400fd790a0ceb1b1c7c37578810217a4f;p=platform%2Fcore%2Fapi%2Fperipheral-io.git gpio: unuse pin in gpio handle Change-Id: I13df7070d2647a36752d46966bdb2fc71a2facfe Signed-off-by: Segwon --- diff --git a/include/gdbus/peripheral_gdbus_gpio.h b/include/gdbus/peripheral_gdbus_gpio.h index 9402a0b..edef2ea 100644 --- a/include/gdbus/peripheral_gdbus_gpio.h +++ b/include/gdbus/peripheral_gdbus_gpio.h @@ -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__ */ diff --git a/include/peripheral_handle.h b/include/peripheral_handle.h index be8a066..0fc1b25 100644 --- a/include/peripheral_handle.h +++ b/include/peripheral_handle.h @@ -21,7 +21,6 @@ * @brief Internal struct for gpio context */ struct _peripheral_gpio_s { - int pin; uint handle; int fd_direction; int fd_edge; diff --git a/src/gdbus/peripheral_gdbus_gpio.c b/src/gdbus/peripheral_gdbus_gpio.c index 43ee5b7..5400429 100644 --- a/src/gdbus/peripheral_gdbus_gpio.c +++ b/src/gdbus/peripheral_gdbus_gpio.c @@ -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, diff --git a/src/peripheral_gpio.c b/src/peripheral_gpio.c index b6ea462..152be9a 100644 --- a/src/peripheral_gpio.c +++ b/src/peripheral_gpio.c @@ -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);