/* Perform a transfer over SMBUS. This thing is called under the i2c bus lock, so we shouldn't race with ourselves...  */
static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char rw, u8 command, int size, union i2c_smbus_data *data)
/* Perform a transfer over SMBUS. This thing is called under the i2c bus lock, so we shouldn't race with ourselves...  */
static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char rw, u8 command, int size, union i2c_smbus_data *data)
{
	struct v4l2_device *v4l2_dev = i2c_get_adapdata(adapter);
	struct cafe_camera *cam = to_cam(v4l2_dev);
	int ret = -EINVAL;
	if (size != I2C_SMBUS_BYTE_DATA) {
		cam_err(cam, "funky xfer size %d\n", size);
		return -EINVAL;
	}
	if (rw == I2C_SMBUS_WRITE)
		ret = cafe_smbus_write_data(cam, addr, command, data->byte);
	else if (rw == I2C_SMBUS_READ)
		ret = cafe_smbus_read_data(cam, addr, command, &data->byte);
	return ret;
}