/* sca3000_show_reg() - sysfs interface to read the chip revision number  */
static ssize_t sca3000_show_rev(struct device *dev, struct device_attribute *attr, char *buf)
/* sca3000_show_reg() - sysfs interface to read the chip revision number  */
static ssize_t sca3000_show_rev(struct device *dev, struct device_attribute *attr, char *buf)
{
	int len = 0, ret;
	struct iio_dev *dev_info = dev_get_drvdata(dev);
	struct sca3000_state *st = dev_info->dev_data;
	u8 *rx;
	mutex_lock(&st->lock);
	ret = sca3000_read_data(st, SCA3000_REG_ADDR_REVID, &rx, 1);
	if (ret < 0)
		goto error_ret;
	len += sprintf(buf + len,
		       "major=%d, minor=%d\n",
		       rx[1] & SCA3000_REVID_MAJOR_MASK,
		       rx[1] & SCA3000_REVID_MINOR_MASK);
	kfree(rx);
error_ret:
	mutex_unlock(&st->lock);
	return ret ? ret : len;
}