/* Write a value to a register in an TCM825X sensor device. Returns zero if successful, or non-zero otherwise.  */
static int tcm825x_write_reg(struct i2c_client *client, u8 reg, u8 val)
/* Write a value to a register in an TCM825X sensor device. Returns zero if successful, or non-zero otherwise.  */
static int tcm825x_write_reg(struct i2c_client *client, u8 reg, u8 val)
{
	int err;
	struct i2c_msg msg[1];
	unsigned char data[2];
	if (!client->adapter)
		return -ENODEV;
	msg->addr = client->addr;
	msg->flags = 0;
	msg->len = 2;
	msg->buf = data;
	data[0] = reg;
	data[1] = val;
	err = i2c_transfer(client->adapter, msg, 1);
	if (err >= 0)
		return 0;
	return err;
}