linux/drivers/iio/accel
Hans de Goede ab77f8541e iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers
commit 0145b50566 upstream.

Before this commit sensor_hub_input_attr_get_raw_value() failed to take
the signedness of 16 and 8 bit values into account, returning e.g.
65436 instead of -100 for the z-axis reading of an accelerometer.

This commit adds a new is_signed parameter to the function and makes all
callers pass the appropriate value for this.

While at it, this commit also fixes up some neighboring lines where
statements were needlessly split over 2 lines to improve readability.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
[bwh: Backported to 3.16:
 - sensor_hub_input_attr_get_raw_value() doesn't take a sync/async flag
   parameter
 - In sensor_hub_input_attr_get_raw_value() keep using data->pending instead of
   hsdev->pending
 - In magn_3d_read_raw() keep using chan->scan_index intstead of chan->address
 - Drop changes in hid-sensor-{custom,humidity,temperature}
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-02-11 17:54:05 +00:00
..
bma180.c iio: fix drivers that check buffer->scan_mask 2015-04-13 16:48:55 +01:00
hid-sensor-accel-3d.c iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
Kconfig iio: Add Freescale MMA8452Q 3-axis accelerometer driver 2014-05-03 12:06:25 +01:00
kxsd9.c iio: accel: kxsd9: Fix scaling bug 2016-11-20 01:17:22 +00:00
Makefile iio: Add Freescale MMA8452Q 3-axis accelerometer driver 2014-05-03 12:06:25 +01:00
mma8452.c iio: mma8452: Use correct acceleration units. 2014-07-12 13:18:55 +01:00
st_accel.h iio: Added ST-sensors platform data to select the DRDY interrupt pin 2013-08-03 18:40:28 +01:00
st_accel_buffer.c iio:st_accel: Drop redundant call to iio_sw_buffer_preenable() 2013-10-16 19:11:11 +01:00
st_accel_core.c iio: accel: st_accel: fix data-ready line configuration 2017-11-26 13:50:19 +00:00
st_accel_i2c.c iio: accel: st_accel: Use devm_iio_device_alloc 2013-08-03 18:41:18 +01:00
st_accel_spi.c iio: accel: st_accel_spi: fix spi_device_id table 2017-10-12 15:27:47 +01:00