/* To write, we just access the chip's address in write mode, and dump the command and data out on the bus. The command byte and data are taken as sequential u8s out of varargs, to a maximum of LM8323_MAX_DATA.  */
static int lm8323_write(struct lm8323_chip *lm, int len,...)
/* To write, we just access the chip's address in write mode, and dump the command and data out on the bus. The command byte and data are taken as sequential u8s out of varargs, to a maximum of LM8323_MAX_DATA.  */
static int lm8323_write(struct lm8323_chip *lm, int len,...)
{
	int ret, i;
	va_list ap;
	u8 data[LM8323_MAX_DATA];
	va_start(ap, len);
	if (unlikely(len > LM8323_MAX_DATA)) {
		dev_err(&lm->client->dev, "tried to send %d bytes\n", len);
		va_end(ap);
		return 0;
	}
	for (i = 0; i < len; i++)
		data[i] = va_arg(ap, int);
	va_end(ap);
	ret = i2c_master_send(lm->client, data, len);
	if (unlikely(ret == -EREMOTEIO))
		ret = i2c_master_send(lm->client, data, len);
	if (unlikely(ret != len))
		dev_err(&lm->client->dev, "sent %d bytes of %d total\n",
			len, ret);
	return ret;
}