/* To read, we first send the command byte to the chip and end the transaction, then access the chip in read mode, at which point it will send the data.  */
static int lm8323_read(struct lm8323_chip *lm, u8 cmd, u8 *buf, int len)
/* To read, we first send the command byte to the chip and end the transaction, then access the chip in read mode, at which point it will send the data.  */
static int lm8323_read(struct lm8323_chip *lm, u8 cmd, u8 *buf, int len)
{
	int ret;
	ret = i2c_master_send(lm->client, &cmd, 1);
	if (unlikely(ret == -EREMOTEIO))
		ret = i2c_master_send(lm->client, &cmd, 1);
	if (unlikely(ret != 1)) {
		dev_err(&lm->client->dev, "sending read cmd 0x%02x failed\n",
			cmd);
		return 0;
	}
	ret = i2c_master_recv(lm->client, buf, len);
	if (unlikely(ret != len))
		dev_err(&lm->client->dev, "wanted %d bytes, got %d\n",
			len, ret);
	return ret;
}