Re: [PATCH v2] iio: accel: Add driver for the MiraMEMS DA311 3-axis 12-bit digital accelerometer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/09/16 16:11, Lars-Peter Clausen wrote:
> On 09/22/2016 03:42 PM, Hans de Goede wrote:
> [...]
>> +	switch (mask) {
>> +	case IIO_CHAN_INFO_RAW:
>> +		ret = i2c_smbus_read_word_data(data->client, chan->address);
>> +		if (ret < 0)
>> +			return ret;
>> +		/*
>> +		 * Values are 12 bits, stored as 16 bits with the 4
>> +		 * least significant bits always 0.
>> +		 */
>> +		*val = ((short)le16_to_cpu(ret)) >> 4;
> 
> I think the le16_to_cpu() is a leftover from the switch away from
> i2c_smbus_read_i2c_block_data(). i2c_smbus_read_word_data() already returns
> CPU endianess data. On a BE system le16_to_cpu() swaps the lower and upper
> bytes on a BE system. So you'd get the wrong value in that case.
Backed out.  Please check the scale value as well for v3.

Thanks,

Jonathan
> 
>> +		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
> 

--
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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux