summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-10-31 15:20:05 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-05 19:32:13 +0100
commitec800c8b028ec5b42dc81421d04a6d4649d44b51 (patch)
treebc443e37a95a1a814531b0724f865a276dae6cd1 /drivers/rtc
parent91f1c5c65d733086d1af756e4405b324e87d8bf0 (diff)
downloadlinux-stable-ec800c8b028ec5b42dc81421d04a6d4649d44b51.tar.gz
linux-stable-ec800c8b028ec5b42dc81421d04a6d4649d44b51.tar.bz2
linux-stable-ec800c8b028ec5b42dc81421d04a6d4649d44b51.zip
iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers
commit 0145b50566e7de5637e80ecba96c7f0e6fff1aad 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> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-hid-sensor-time.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
index 2751dba850c6..3e1abb455472 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -213,7 +213,7 @@ static int hid_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* get a report with all values through requesting one value */
sensor_hub_input_attr_get_raw_value(time_state->common_attributes.hsdev,
HID_USAGE_SENSOR_TIME, hid_time_addresses[0],
- time_state->info[0].report_id, SENSOR_HUB_SYNC);
+ time_state->info[0].report_id, SENSOR_HUB_SYNC, false);
/* wait for all values (event) */
ret = wait_for_completion_killable_timeout(
&time_state->comp_last_time, HZ*6);