On 10/14/2013 11:34 PM, Peter Meerwald wrote:
+/* Return the measurement value from the specified channel */ +static int hmc5843_read_measurement(struct hmc5843_data *data, + int idx, int *val) +{ + s32 result; + s16 values[3];
I'm currently trying to make iio pass `make C=2 CF=-D__CHECK_ENDIAN__`. This should be __be16
+ + mutex_lock(&data->lock); + result = hmc5843_wait_measurement(data); + if (result < 0) { + mutex_unlock(&data->lock); + return result; + } + result = i2c_smbus_read_i2c_block_data(data->client, + HMC5843_DATA_OUT_MSB_REGS, sizeof(values), (u8 *) values); mutex_unlock(&data->lock); if (result < 0) return -EINVAL; - *val = sign_extend32(result, 15); + *val = sign_extend32(be16_to_cpu(values[idx]), 15); return IIO_VAL_INT; }
[...] -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html