/* Prepare controller for a transaction and call i2c_davinci_xfer_msg  */
static int i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
/* Prepare controller for a transaction and call i2c_davinci_xfer_msg  */
static int i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{
	struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
	int i;
	int ret;
	dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
	ret = i2c_davinci_wait_bus_not_busy(dev, 1);
	if (ret < 0) {
		dev_warn(dev->dev, "timeout waiting for bus ready\n");
		return ret;
	}
	for (i = 0; i < num; i++) {
		ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
		dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
			ret);
		if (ret < 0)
			return ret;
	}
	return num;
}