/* Prepare controller for a transaction and call omap_i2c_xfer_msg to do the work during IRQ processing.  */
static int omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
/* Prepare controller for a transaction and call omap_i2c_xfer_msg to do the work during IRQ processing.  */
static int omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{
	struct omap_i2c_dev *dev = i2c_get_adapdata(adap);
	int i;
	int r;
	omap_i2c_unidle(dev);
	r = omap_i2c_wait_for_bb(dev);
	if (r < 0)
		goto out;
	for (i = 0; i < num; i++) {
		r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1)));
		if (r != 0)
			break;
	}
	if (r == 0)
		r = num;
out:
	omap_i2c_idle(dev);
	return r;
}