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

iio: accel: bmc150-accel: Balanced runtime pm + use pm_runtime_resume_and_get()

A call to pm_runtime_put_noidle() doesn't match any call that would
result in a get(). It is safe because runtime pm core protects against
the reference counter going 0, but it makes it harder to understand the
code.

Whilst here use pm_runtime_resume_and_get() to tidy things up.
The Coccinelle script didn't get this one due to more complex code
structure.

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-5-jic23@kernel.org

+1 -5
+1 -5
drivers/iio/accel/bmc150-accel-core.c
··· 389 389 int ret; 390 390 391 391 if (on) { 392 - ret = pm_runtime_get_sync(dev); 392 + ret = pm_runtime_resume_and_get(dev); 393 393 } else { 394 394 pm_runtime_mark_last_busy(dev); 395 395 ret = pm_runtime_put_autosuspend(dev); ··· 398 398 if (ret < 0) { 399 399 dev_err(dev, 400 400 "Failed: %s for %d\n", __func__, on); 401 - if (on) 402 - pm_runtime_put_noidle(dev); 403 - 404 401 return ret; 405 402 } 406 403 ··· 1833 1836 1834 1837 pm_runtime_disable(dev); 1835 1838 pm_runtime_set_suspended(dev); 1836 - pm_runtime_put_noidle(dev); 1837 1839 1838 1840 bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1); 1839 1841