OSDN Git Service

iio: hid-sensor: Fix unbalanced pm_runtime_enable error
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Sat, 8 Apr 2017 00:16:34 +0000 (17:16 -0700)
committerJonathan Cameron <jic23@kernel.org>
Sat, 8 Apr 2017 14:36:47 +0000 (15:36 +0100)
When a hid sensor module is removed and modprobed again we see
error for unbalanced pm_runtime. This issue is caused by not
deactivating runtime PM on removal. So on modprobe again when
activated again, this will print this error.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/hid-sensors/hid-sensor-trigger.c

index ecf592d..8cadc48 100644 (file)
@@ -138,6 +138,10 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
 
 void hid_sensor_remove_trigger(struct hid_sensor_common *attrb)
 {
+       pm_runtime_disable(&attrb->pdev->dev);
+       pm_runtime_set_suspended(&attrb->pdev->dev);
+       pm_runtime_put_noidle(&attrb->pdev->dev);
+
        cancel_work_sync(&attrb->work);
        iio_trigger_unregister(attrb->trigger);
        iio_trigger_free(attrb->trigger);