Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: hid: trigger: Balance runtime pm + use pm_runtime_resume_and_get()

The call to pm_runtime_put_noidle() in remove() callback is not
balanced by any gets

Note this doesn't cause any problems beyond reader confusion as the runtime
pm core protects against the reference counter going negative.

Whilst here, use pm_runtiem_resume_and_get() to simplify code a little.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-9-jic23@kernel.org

+2 -6
+2 -6
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
··· 163 163 164 164 if (state) { 165 165 atomic_inc(&st->user_requested_state); 166 - ret = pm_runtime_get_sync(&st->pdev->dev); 166 + ret = pm_runtime_resume_and_get(&st->pdev->dev); 167 167 } else { 168 168 atomic_dec(&st->user_requested_state); 169 169 pm_runtime_mark_last_busy(&st->pdev->dev); 170 170 pm_runtime_use_autosuspend(&st->pdev->dev); 171 171 ret = pm_runtime_put_autosuspend(&st->pdev->dev); 172 172 } 173 - if (ret < 0) { 174 - if (state) 175 - pm_runtime_put_noidle(&st->pdev->dev); 173 + if (ret < 0) 176 174 return ret; 177 - } 178 175 179 176 return 0; 180 177 #else ··· 219 222 pm_runtime_disable(&attrb->pdev->dev); 220 223 221 224 pm_runtime_set_suspended(&attrb->pdev->dev); 222 - pm_runtime_put_noidle(&attrb->pdev->dev); 223 225 224 226 cancel_work_sync(&attrb->work); 225 227 iio_trigger_unregister(attrb->trigger);