/* Write a value to a register in an TVP5146/47 decoder device. Returns zero if successful, or non-zero otherwise.  */
static int tvp514x_write_reg(struct v4l2_subdev *sd, u8 reg, u8 val)
/* Write a value to a register in an TVP5146/47 decoder device. Returns zero if successful, or non-zero otherwise.  */
static int tvp514x_write_reg(struct v4l2_subdev *sd, u8 reg, u8 val)
{
	int err, retry = 0;
	struct i2c_client *client = v4l2_get_subdevdata(sd);
write_again:
	err = i2c_smbus_write_byte_data(client, reg, val);
	if (err) {
		if (retry <= I2C_RETRY_COUNT) {
			v4l2_warn(sd, "Write: retry ... %d\n", retry);
			retry++;
			msleep_interruptible(10);
			goto write_again;
		}
	}
	return err;
}