diff options
author | Hans de Goede <hdegoede@redhat.com> | 2018-04-14 18:09:09 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2018-04-21 17:52:35 +0300 |
commit | 6f92253024d9d947a4f454654840ce479e251376 (patch) | |
tree | 05d1eba07ddb9e26f346850aac1420eac7234f97 /lib/cpumask.c | |
parent | f0c8d1f6dc8eac5a1fbf441c8e080721a7b6c0ff (diff) | |
download | linux-6f92253024d9d947a4f454654840ce479e251376.tar.xz |
iio: hid-sensor-trigger: Fix sometimes not powering up the sensor after resume
hid_sensor_set_power_work() powers the sensors back up after a resume
based on the user_requested_state atomic_t.
But hid_sensor_power_state() treats this as a boolean flag, leading to
the following problematic scenario:
1) Some app starts using the iio-sensor in buffered / triggered mode,
hid_sensor_data_rdy_trigger_set_state(true) gets called, setting
user_requested_state to 1.
2) Something directly accesses a _raw value through sysfs, leading
to a call to hid_sensor_power_state(true) followed by
hid_sensor_power_state(false) call, this sets user_requested_state
to 1 followed by setting it to 0.
3) Suspend/resume the machine, hid_sensor_set_power_work() now does
NOT power the sensor back up because user_requested_state (wrongly)
is 0. Which stops the app using the sensor in buffered mode from
receiving any new values.
This commit changes user_requested_state to a counter tracking how many
times hid_sensor_power_state(true) was called instead, fixing this.
Cc: Bastien Nocera <hadess@hadess.net>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'lib/cpumask.c')
0 files changed, 0 insertions, 0 deletions