summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2021-05-09 12:33:33 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-05-17 13:54:26 +0100
commit19611aec50aed607fe161e8a2b8f40df9d97df60 (patch)
treeeb77b9e4a14c8a69d563b57e85d49ddd95d8c6d0
parent2d980d7efd5fdac70505a5b82cfaef411fa72393 (diff)
iio: accel: kxcjk-1013: Balance runtime pm + use pm_runtime_resume_and_get()
This driver alls pm_runtime_put_noidle() in it's remove function, but there is no matching get call. This isn't a bug as runtime pm will not allow the reference counter to go negative, but it is missleading so lets remove it. Whilst here use pm_runtime_resume_and_get() to tidy up some boilerplate. The coccicheck script didn't get this one due to the less obvious structure. Found by inspection. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/20210509113354.660190-8-jic23@kernel.org
-rw-r--r--drivers/iio/accel/kxcjk-1013.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 18a96828f6be..961803296abc 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -601,7 +601,7 @@ static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on)
int ret;
if (on)
- ret = pm_runtime_get_sync(&data->client->dev);
+ ret = pm_runtime_resume_and_get(&data->client->dev);
else {
pm_runtime_mark_last_busy(&data->client->dev);
ret = pm_runtime_put_autosuspend(&data->client->dev);
@@ -609,8 +609,6 @@ static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on)
if (ret < 0) {
dev_err(&data->client->dev,
"Failed: %s for %d\n", __func__, on);
- if (on)
- pm_runtime_put_noidle(&data->client->dev);
return ret;
}
#endif
@@ -1616,7 +1614,6 @@ static int kxcjk1013_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
pm_runtime_set_suspended(&client->dev);
- pm_runtime_put_noidle(&client->dev);
if (data->dready_trig) {
iio_triggered_buffer_cleanup(indio_dev);