linux/drivers/iio
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
..
accel iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
adc iio: adc: at91: fix wrong channel number in triggered buffer mode 2019-02-11 17:53:24 +00:00
amplifiers iio: amplifiers: ad8366: Remove regulator_put 2013-09-28 11:49:45 +01:00
common iio: hid-sensor-attributes: Fix sensor property setting failure. 2017-07-18 18:40:29 +01:00
dac iio: ad5064: Fix regulator handling 2019-02-11 17:53:24 +00:00
frequency iio: ad9523: Fix return value for ad952x_store() 2018-12-16 22:08:29 +00:00
gyro iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
humidity iio: dht11: Use usleep_range instead of msleep for start signal 2017-03-16 02:27:04 +00:00
imu iio: adis_lib: Initialize trigger before requesting interrupt 2018-06-16 22:22:19 +01:00
light iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
magnetometer iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
orientation iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
pressure iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2019-02-11 17:54:05 +00:00
proximity iio: proximity: as3935: fix iio_trigger_poll issue 2017-09-15 18:29:33 +01:00
temperature iio: tmp006: Check channel info on write 2015-08-10 09:54:08 +01:00
trigger iio:trigger: fix sysfs name on list mutex 2013-09-28 11:51:16 +01:00
buffer_cb.c iio get rid of unneccessary error_ret 2014-02-18 08:46:36 +00:00
iio_core.h IIO: core: Introduce read_raw_multi 2014-04-29 22:05:32 +01:00
iio_core_trigger.h iio: fix semicolon in io_core_trigger.h 2013-08-03 18:40:32 +01:00
industrialio-buffer.c iio: buffer: check if a buffer has been set up when poll is called 2018-06-16 22:22:19 +01:00
industrialio-core.c iio: core: Return error for failed read_reg 2018-01-01 20:51:38 +00:00
industrialio-event.c iio: event: Remove negative error code from iio_event_poll 2015-09-28 10:21:38 +01:00
industrialio-trigger.c iio: Fix error handling in iio_trigger_attach_poll_func 2016-08-22 22:38:13 +01:00
industrialio-triggered-buffer.c iio:triggered-buffer: Remove redundant call to iio_sw_buffer_preenable(). 2013-10-16 19:12:47 +01:00
inkern.c iio: inkern: fix a NULL dereference on error 2016-02-25 00:18:38 +00:00
Kconfig iio: always select ANON_INODES 2014-05-10 11:39:57 +01:00
kfifo_buf.c iio:kfifo_buf: check for uint overflow 2018-10-21 08:45:05 +01:00
Makefile iio: Add AS3935 lightning sensor support 2014-03-16 18:00:32 +00:00