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

iio: light: isl29028: Balance runtime pm + use pm_runtime_resume_and_get()

In remove this driver called pm_runtime_put_noidle() but there is
no matching get operation. This does not cause any problems because
the reference counter will not change if already zero, but it
does make the code harder to reason about so should be dropped.

Whilst we are here, use pm_runtime_resume_and_get() to replace open
coded version.
Found using coccicheck script under review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-3-jic23@kernel.org

+1 -4
+1 -4
drivers/iio/light/isl29028.c
··· 339 339 int ret; 340 340 341 341 if (on) { 342 - ret = pm_runtime_get_sync(dev); 343 - if (ret < 0) 344 - pm_runtime_put_noidle(dev); 342 + ret = pm_runtime_resume_and_get(dev); 345 343 } else { 346 344 pm_runtime_mark_last_busy(dev); 347 345 ret = pm_runtime_put_autosuspend(dev); ··· 645 647 646 648 pm_runtime_disable(&client->dev); 647 649 pm_runtime_set_suspended(&client->dev); 648 - pm_runtime_put_noidle(&client->dev); 649 650 650 651 return isl29028_clear_configure_reg(chip); 651 652 }