handle: remove unnecessary members in handle. 99/160899/1
authorSegwon <segwon.han@samsung.com>
Mon, 20 Nov 2017 11:15:41 +0000 (20:15 +0900)
committerSegwon <segwon.han@samsung.com>
Mon, 20 Nov 2017 11:15:41 +0000 (20:15 +0900)
Change-Id: If0ff8eae0df81f5bdd84997c69bb48ea9b121ff0
Signed-off-by: Segwon <segwon.han@samsung.com>
src/daemon/include/peripheral_bus.h
src/daemon/peripheral_bus_gpio.c
src/daemon/peripheral_bus_i2c.c
src/daemon/peripheral_bus_uart.c
src/daemon/peripheral_bus_util.c

index 206c4d4..d4baf72 100644 (file)
@@ -57,27 +57,13 @@ typedef struct {
 } pb_client_info_s;
 
 typedef struct {
-       /* gpio info */
        int pin;
-       int direction;
-       int edge;
-       /* interrupt variable */
-       int irq_en;
-       int value_fd;
-       GIOChannel *io;
-       guint io_id;
-       /* gdbus variable */
-       PeripheralIoGdbusGpio *gpio_skeleton;
 } peripheral_bus_gpio_s;
 
 typedef struct {
-       /* i2c device information */
        int bus;
        int address;
        int fd;
-       /* data buffer */
-       uint8_t *buffer;
-       int buffer_size;
 } peripheral_bus_i2c_s;
 
 typedef struct {
@@ -88,19 +74,12 @@ typedef struct {
 typedef struct {
        int port;
        int fd;
-       uint8_t *buffer;
-       int buffer_size;
 } peripheral_bus_uart_s;
 
 typedef struct {
        int bus;
        int cs;
        int fd;
-       /* data buffer */
-       uint8_t *rx_buf;
-       uint8_t *tx_buf;
-       int rx_buf_size;
-       int tx_buf_size;
 } peripheral_bus_spi_s;
 
 typedef struct {
index c725694..567d5a5 100644 (file)
@@ -154,7 +154,6 @@ int peripheral_bus_gpio_open(gint pin, pb_data_h *handle, gpointer user_data)
        gpio_handle->type = PERIPHERAL_BUS_TYPE_GPIO;
        gpio_handle->list = &pb_data->gpio_list;
        gpio_handle->dev.gpio.pin = pin;
-       gpio_handle->dev.gpio.gpio_skeleton = pb_data->gpio_skeleton;
 
        *handle = gpio_handle;
 
index 9897f00..c0ac7d4 100644 (file)
@@ -90,15 +90,6 @@ int peripheral_bus_i2c_open(int bus, int address, pb_data_h *handle, gpointer us
        i2c_handle->dev.i2c.fd = fd;
        i2c_handle->dev.i2c.bus = bus;
        i2c_handle->dev.i2c.address = address;
-       i2c_handle->dev.i2c.buffer = malloc(INITIAL_BUFFER_SIZE);
-
-       if (!(i2c_handle->dev.i2c.buffer)) {
-               peripheral_bus_data_free(i2c_handle);
-               _E("Failed to allocate data buffer");
-               ret = PERIPHERAL_ERROR_OUT_OF_MEMORY;
-               goto err;
-       }
-       i2c_handle->dev.i2c.buffer_size = INITIAL_BUFFER_SIZE;
 
        *handle = i2c_handle;
 
index 2bb7943..cf221c0 100644 (file)
@@ -86,15 +86,6 @@ int peripheral_bus_uart_open(int port, pb_data_h *handle, gpointer user_data)
        uart_handle->dev.uart.fd = fd;
        uart_handle->dev.uart.port = port;
 
-       uart_handle->dev.uart.buffer = (uint8_t*)calloc(1, INITIAL_BUFFER_SIZE);
-       if (!uart_handle->dev.uart.buffer) {
-               _E("Failed to allocate buffer");
-               peripheral_bus_data_free(uart_handle);
-               ret = PERIPHERAL_ERROR_OUT_OF_MEMORY;
-               goto err;
-       }
-
-       uart_handle->dev.uart.buffer_size = INITIAL_BUFFER_SIZE;
        *handle = uart_handle;
 
        return PERIPHERAL_ERROR_NONE;
index 859ebf9..8204885 100644 (file)
@@ -79,25 +79,6 @@ int peripheral_bus_data_free(pb_data_h handle)
 
        *handle->list = g_list_remove_link(list, link);
 
-       switch (handle->type) {
-       case PERIPHERAL_BUS_TYPE_I2C:
-               if (handle->dev.i2c.buffer)
-                       free(handle->dev.i2c.buffer);
-               break;
-       case PERIPHERAL_BUS_TYPE_UART:
-               if (handle->dev.uart.buffer)
-                       free(handle->dev.uart.buffer);
-               break;
-       case PERIPHERAL_BUS_TYPE_SPI:
-               if (handle->dev.spi.rx_buf)
-                       free(handle->dev.spi.rx_buf);
-               if (handle->dev.spi.tx_buf)
-                       free(handle->dev.spi.tx_buf);
-               break;
-       default:
-               break;
-       }
-
        free(handle);
        g_list_free(link);