From 7ac56ac94b3b8b885e16a3d5958a132f4a2aca88 Mon Sep 17 00:00:00 2001 From: Hyeongsik Min Date: Wed, 19 Apr 2017 19:55:22 +0900 Subject: [PATCH] Rename peripheral_i2c_context_h to peripheral_i2c_h Change-Id: Id304caf9e1de0a07d90a8279e7aa03ebaf746234 Signed-off-by: Hyeongsik Min --- src/daemon/peripheral_bus_i2c.c | 37 +++++++++++++++++++------------------ src/daemon/peripheral_bus_i2c.h | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/daemon/peripheral_bus_i2c.c b/src/daemon/peripheral_bus_i2c.c index 0493f2d..b6671be 100644 --- a/src/daemon/peripheral_bus_i2c.c +++ b/src/daemon/peripheral_bus_i2c.c @@ -19,54 +19,55 @@ #include #include +#include #include "i2c.h" #include "peripheral_common.h" -int peripheral_bus_i2c_init(peripheral_i2c_context_h dev, int bus) +int peripheral_bus_i2c_init(peripheral_i2c_h i2c, int bus) { - return i2c_open(bus, &dev->fd); + return i2c_open(bus, &i2c->fd); } -int peripheral_bus_i2c_set_addr(peripheral_i2c_context_h dev, int addr) +int peripheral_bus_i2c_set_addr(peripheral_i2c_h i2c, int addr) { - return i2c_set_address(dev->fd, addr); + return i2c_set_address(i2c->fd, addr); } -int peripheral_bus_i2c_read(peripheral_i2c_context_h dev, int length, unsigned char * data, int addr) +int peripheral_bus_i2c_read(peripheral_i2c_h i2c, int length, unsigned char * data, int addr) { - return i2c_read(dev->fd, data, length, addr); + return i2c_read(i2c->fd, data, length, addr); } -int peripheral_bus_i2c_write(peripheral_i2c_context_h dev, int length, unsigned char * data, int addr) +int peripheral_bus_i2c_write(peripheral_i2c_h i2c, int length, unsigned char * data, int addr) { - return i2c_write(dev->fd, data, length, addr); + return i2c_write(i2c->fd, data, length, addr); } -int peripheral_bus_i2c_stop(peripheral_i2c_context_h dev) +int peripheral_bus_i2c_stop(peripheral_i2c_h i2c) { - return i2c_close(dev->fd); + return i2c_close(i2c->fd); } -int peripheral_bus_i2c_process(peripheral_i2c_context_h dev, char *func_name, int value, unsigned char *data, int addr) +int peripheral_bus_i2c_process(peripheral_i2c_h i2c, char *func_name, int value, unsigned char *data, int addr) { int ret = PERIPHERAL_ERROR_NONE; - if (dev == NULL) { - _E("dev null error"); + if (i2c == NULL) { + _E("i2c null error"); return PERIPHERAL_ERROR_INVALID_PARAMETER; } if (!g_strcmp0(func_name, "INIT")) - ret = peripheral_bus_i2c_init(dev, value); + ret = peripheral_bus_i2c_init(i2c, value); else if (!g_strcmp0(func_name, "SET_ADDR")) - ret = peripheral_bus_i2c_set_addr(dev, value); + ret = peripheral_bus_i2c_set_addr(i2c, value); else if (!g_strcmp0(func_name, "READ")) - ret = peripheral_bus_i2c_read(dev, value, data, addr); + ret = peripheral_bus_i2c_read(i2c, value, data, addr); else if (!g_strcmp0(func_name, "WRITE")) - ret = peripheral_bus_i2c_write(dev, value, data, addr); + ret = peripheral_bus_i2c_write(i2c, value, data, addr); else if (!g_strcmp0(func_name, "STOP")) - ret = peripheral_bus_i2c_stop(dev); + ret = peripheral_bus_i2c_stop(i2c); return ret; } diff --git a/src/daemon/peripheral_bus_i2c.h b/src/daemon/peripheral_bus_i2c.h index 230cad8..e406f83 100644 --- a/src/daemon/peripheral_bus_i2c.h +++ b/src/daemon/peripheral_bus_i2c.h @@ -17,6 +17,6 @@ #ifndef __PERIPHERAL_BUS_I2C_H__ #define __PERIPHERAL_BUS_I2C_H__ -int peripheral_bus_i2c_process(peripheral_i2c_context_h dev, char *func_name, int value, unsigned char *data, int addr); +int peripheral_bus_i2c_process(peripheral_i2c_h i2c, char *func_name, int value, unsigned char *data, int addr); #endif /* __PERIPHERAL_BUS_I2C_H__ */ -- 2.7.4