/* sca3000_show_ring_bpse() -sysfs function to query bits per sample from ring @dev: ring buffer device @attr: this device attribute @buf: buffer to write to  */
static ssize_t sca3000_show_ring_bpse(struct device *dev, struct device_attribute *attr, char *buf)
/* sca3000_show_ring_bpse() -sysfs function to query bits per sample from ring @dev: ring buffer device @attr: this device attribute @buf: buffer to write to  */
static ssize_t sca3000_show_ring_bpse(struct device *dev, struct device_attribute *attr, char *buf)
{
	int len = 0, ret;
	u8 *rx;
	struct iio_ring_buffer *r = dev_get_drvdata(dev);
	struct sca3000_state *st = r->indio_dev->dev_data;
	mutex_lock(&st->lock);
	ret = sca3000_read_data(st, SCA3000_REG_ADDR_MODE, &rx, 1);
	if (ret)
		goto error_ret;
	len = sprintf(buf, "%d\n", (rx[1] & SCA3000_RING_BUF_8BIT) ? 8 : 11);
	kfree(rx);
error_ret:
	mutex_unlock(&st->lock);
	return ret ? ret : len;
}