Merge 4.2-rc3 into staging-next
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -36,6 +36,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
||||
s32 poll_value = 0;
|
||||
|
||||
if (state) {
|
||||
if (!atomic_read(&st->user_requested_state))
|
||||
return 0;
|
||||
if (sensor_hub_device_open(st->hsdev))
|
||||
return -EIO;
|
||||
|
||||
@@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
||||
|
||||
poll_value = hid_sensor_read_poll_value(st);
|
||||
} else {
|
||||
if (!atomic_dec_and_test(&st->data_ready))
|
||||
int val;
|
||||
|
||||
val = atomic_dec_if_positive(&st->data_ready);
|
||||
if (val < 0)
|
||||
return 0;
|
||||
|
||||
sensor_hub_device_close(st->hsdev);
|
||||
state_val = hid_sensor_get_usage_index(st->hsdev,
|
||||
st->power_state.report_id,
|
||||
@@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state);
|
||||
|
||||
int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int ret;
|
||||
|
||||
atomic_set(&st->user_requested_state, state);
|
||||
if (state)
|
||||
ret = pm_runtime_get_sync(&st->pdev->dev);
|
||||
else {
|
||||
@@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
||||
|
||||
return 0;
|
||||
#else
|
||||
atomic_set(&st->user_requested_state, state);
|
||||
return _hid_sensor_power_state(st, state);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user