summaryrefslogtreecommitdiff
path: root/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-03 16:28:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-03 16:28:14 +0300
commita6d361404d81a03107a3475876afc22e1b84d5de (patch)
tree38434c6076ee2d8aee4ce952172254a0edfe1486 /drivers/iio/common/hid-sensors/hid-sensor-attributes.c
parentc02ed2e75ef4c74e41e421acb4ef1494671585e8 (diff)
parentbba6d9e47f3ea894e501f94b086a59ffe28241ac (diff)
downloadlinux-a6d361404d81a03107a3475876afc22e1b84d5de.tar.xz
Merge tag 'iio-fixes-for-4.11d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
4th set of IIO fixes for the 4.12 cycle. core - fix IIO_VAL_FRACTIONAL_LOG2 handling for negative values. bmg160 - reset chip on probe to avoid a failure on some systems cros_ec - return type correctly when reading raw and calibbias data. hid-sensor-accel - fix a duplicate scan index error due to wrong number of channels for gravity sensor. hid-sensors - ensure a get_feature is always done before the first set feature to avoid issues with wrong cached values. st-pressure - initalize lps22hb boot time to avoid giving stale data.
Diffstat (limited to 'drivers/iio/common/hid-sensors/hid-sensor-attributes.c')
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-attributes.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 7afdac42ed42..01e02b9926d4 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -379,6 +379,8 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
{
struct hid_sensor_hub_attribute_info timestamp;
+ s32 value;
+ int ret;
hid_sensor_get_reporting_interval(hsdev, usage_id, st);
@@ -417,6 +419,14 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
st->sensitivity.index, st->sensitivity.report_id,
timestamp.index, timestamp.report_id);
+ ret = sensor_hub_get_feature(hsdev,
+ st->power_state.report_id,
+ st->power_state.index, sizeof(value), &value);
+ if (ret < 0)
+ return ret;
+ if (value < 0)
+ return -EINVAL;
+
return 0;
}
EXPORT_SYMBOL(hid_sensor_parse_common_attributes);