From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Resend because I managed to misstype kernel.org in the first set of email addresses. Sorry all who hence get this twice. Two basic types of tidying up in here. 1) Cases where pm_runtime_put_noidle() is called in remove() path but not matched with any form of get 2) Using pm_runtime_resume_and_get() to either replace existing error handling or to introduce it where errors were previously ignored. Note the unbalanced put is not a bug as such, because the runtime pm core protects against the reference count going negative. However, it is a bad pattern to have copied into new drivers (as it confuses me) so I'd like to clear it out. Inspired by Mauro's work on similar issues in media and Julia's coccicheck script. There will be at least one more set of these once this first set have flushed out any mistakes I may have made. I checked my assumptions around the excess pm_runtime_put_noidle calls in QEMU but may well be missing something even so. Cc: Andreas Klinger <ak@xxxxxxxxxxxxx> Cc: Brian Masney <masneyb@xxxxxxxxxxxxx> Cc: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx> Cc: Hans de Goede <hdegoede@xxxxxxxxxx> Cc: Jean-Baptiste Maneyrol <jmaneyrol@xxxxxxxxxxxxxx> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx> Cc: Marek Vasut <marek.vasut@xxxxxxxxx> Cc: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx> Cc: Mathieu Othacehe <m.othacehe@xxxxxxxxx> Cc: Mike Looijmans <mike.looijmans@xxxxxxxx> Cc: Mikko Koivunen <mikko.koivunen@xxxxxxxxxxxxxxxxx> Cc: Parthiban Nallathambi <pn@xxxxxxx> Cc: Rui Miguel Silva <rui.silva@xxxxxxxxxx> Cc: Sean Nyekjaer <sean@xxxxxxxxxx> Cc: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx> Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx> Cc: jic23@xxxxxxxxxx Jonathan Cameron (28): iio: gyro: fxa210002c: Balance runtime pm + use pm_runtime_resume_and_get(). iio: light: isl29028: Balance runtime pm + use pm_runtime_resume_and_get() iio: light: tsl2583: Balance runtime pm + use pm_runtime_resume_and_get() iio: accel: bmc150-accel: Balanced runtime pm + use pm_runtime_resume_and_get() iio: accel: mma8452: Balance runtime pm + use pm_runtime_resume_and_get() iio: accel: mma9551/3: Balance untime pm + use pm_runtime_resume_and_get() iio: accel: kxcjk-1013: Balance runtime pm + use pm_runtime_resume_and_get() iio: hid: trigger: Balance runtime pm + use pm_runtime_resume_and_get() iio: imu: kmx61: Balance runtime pm + use pm_runtime_resume_and_get() iio: light: rpr0521: Balance runtime pm + use pm_runtime_resume_and_get() iio: magn: bmc150: Balance runtime pm + use pm_runtime_resume_and_get() iio: accel: bmi088: Balance runtime pm + use pm_runtime_resume_and_get() iio: imu: mpu6050: Use pm_runtime_resume_and_get() to replace open coding. iio: adc: stm32-adc: Use pm_runtime_resume_and_get() to replace open coding. iio: adc: stm32-dfsdm: Use pm_runtime_resume_and_get() to replace open coding. iio: dac: stm32-dac: Use pm_runtime_resume_and_get() to replace open coding. iio: adc: ads1015: Use pm_runtime_resume_and_get() to replace open coding. iio: chemical: atlas-sensor: Use pm_runtime_resume_and_get() to replace open coding. iio: light: pa12203001: Use pm_runtime_resume_and_get() to replace open coding. iio: light: us5182: Use pm_runtime_resume_and_get() to replace open coding. iio: light: vcnl4000: Use pm_runtime_resume_and_get() to replace open coding. iio: light: vcnl4035: Use pm_runtime_resume_and_get() to replace open coding. iio: pressure: zpa2326: fix potential extra call of runtime suspend. iio: temp: mlx90614: Handle failure in pm_runtime_resume_and_get() iio: proximity: srf04: Use pm_runtime_resume_and_get() and handle error iio: prox: pulsed-light-v2: Switch pm_runtime_resume_and_get() iio: pressure: icp10100: Use pm_runtime_resume_and_get() + handle errors iio: adc: rcar-gyroadc: Use pm_runtime_resume_and_get() and check in probe() drivers/iio/accel/bmc150-accel-core.c | 6 +---- drivers/iio/accel/bmi088-accel-core.c | 26 ++++++++++++++----- drivers/iio/accel/kxcjk-1013.c | 5 +--- drivers/iio/accel/mma8452.c | 5 +--- drivers/iio/accel/mma9551.c | 1 - drivers/iio/accel/mma9551_core.c | 4 +-- drivers/iio/accel/mma9553.c | 1 - drivers/iio/adc/rcar-gyroadc.c | 15 +++++------ drivers/iio/adc/stm32-adc.c | 24 ++++++----------- drivers/iio/adc/stm32-dfsdm-core.c | 6 ++--- drivers/iio/adc/ti-ads1015.c | 4 +-- drivers/iio/chemical/atlas-sensor.c | 12 +++------ .../common/hid-sensors/hid-sensor-trigger.c | 8 ++---- drivers/iio/dac/stm32-dac.c | 3 +-- drivers/iio/gyro/fxas21002c_core.c | 11 +------- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 18 +++++-------- drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 6 ++--- drivers/iio/imu/kmx61.c | 5 +--- drivers/iio/light/isl29028.c | 5 +--- drivers/iio/light/pa12203001.c | 4 +-- drivers/iio/light/rpr0521.c | 7 +---- drivers/iio/light/tsl2583.c | 13 +++++----- drivers/iio/light/us5182d.c | 4 +-- drivers/iio/light/vcnl4000.c | 4 +-- drivers/iio/light/vcnl4035.c | 4 +-- drivers/iio/magnetometer/bmc150_magn.c | 10 +++---- drivers/iio/pressure/icp10100.c | 4 ++- drivers/iio/pressure/zpa2326.c | 6 ++--- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 4 ++- drivers/iio/proximity/srf04.c | 8 +++--- drivers/iio/temperature/mlx90614.c | 25 ++++++++++++++---- 31 files changed, 109 insertions(+), 149 deletions(-) -- 2.31.1