i2c: simplify API and driver_api with generic transfer function

With the introduction of generic transfer function, it is no longer
needed to specify read or write functions explicitly in drivers.
All read/write functions can now thus call the generic transfer
function to achieve the same result.

With this change, the transfer function becomes mandatory, and
should always be available.

Change-Id: Ia6fb98e58b84330a56a5d44ed3df9db42c3a5e88
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2015-10-09 10:38:10 -07:00 committed by Anas Nashif
commit 1c96cdeb52
2 changed files with 7 additions and 50 deletions

View file

@ -716,27 +716,6 @@ static int i2c_dw_set_callback(struct device *dev, i2c_callback cb)
return DEV_OK;
}
static int i2c_dw_write(struct device *dev, uint8_t *buf,
uint32_t len, uint16_t slave_addr)
{
return i2c_dw_transfer(dev, buf, len, 0, 0, slave_addr, 0);
}
static int i2c_dw_read(struct device *dev, uint8_t *buf,
uint32_t len, uint16_t slave_addr)
{
return i2c_dw_transfer(dev, 0, 0, buf, len, slave_addr, 0);
}
static int i2c_dw_polling_write(struct device *dev,
uint8_t *write_buf, uint32_t write_len,
uint16_t slave_address)
{
return i2c_dw_poll_transfer(dev, write_buf, write_len,
0, 0, slave_address, 0);
}
static int i2c_dw_suspend(struct device *dev)
{
DBG("I2C: suspend called - function not yet implemented\n");
@ -756,12 +735,9 @@ static int i2c_dw_resume(struct device *dev)
static struct i2c_driver_api funcs = {
.configure = i2c_dw_runtime_configure,
.set_callback = i2c_dw_set_callback,
.write = i2c_dw_write,
.read = i2c_dw_read,
.transfer = i2c_dw_transfer,
.suspend = i2c_dw_suspend,
.resume = i2c_dw_resume,
.polling_write = i2c_dw_polling_write,
.poll_transfer = i2c_dw_poll_transfer,
};