/* The alignment of data in here is downright odd. See data sheet. Converting this into a meaningful value is left to inline functions in userspace part of header.  */
static ssize_t sca3000_read_temp(struct device *dev, struct device_attribute *attr, char *buf)
/* The alignment of data in here is downright odd. See data sheet. Converting this into a meaningful value is left to inline functions in userspace part of header.  */
static ssize_t sca3000_read_temp(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct iio_dev *indio_dev = dev_get_drvdata(dev);
	struct sca3000_state *st = indio_dev->dev_data;
	int len = 0, ret;
	int val;
	u8 *rx;
	ret = sca3000_read_data(st, SCA3000_REG_ADDR_TEMP_MSB, &rx, 2);
	if (ret < 0)
		goto error_ret;
	val = ((rx[1]&0x3F) << 3) | ((rx[2] & 0xE0) >> 5);
	len += sprintf(buf + len, "%d\n", val);
	kfree(rx);
	return len;
error_ret:
	return ret;
}