iio: accel: kxcjk-1013: only set power state if CONFIG_PM is defined
authorIrina Tirdea <irina.tirdea@intel.com>
Fri, 5 Dec 2014 22:18:08 +0000 (00:18 +0200)
committerJonathan Cameron <jic23@kernel.org>
Fri, 12 Dec 2014 12:28:27 +0000 (12:28 +0000)
When CONFIG_PM is not defined and the driver tries to power off the device,
kxcjk1013_set_power_state will call pm_runtime_put_autosuspend, which is
not implemented (wil return -ENOSYS).

Only call pm_runtime calls to change power state  when CONFIG_PM is defined.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/kxcjk-1013.c

index aed377797ded1f6c2251eb0c9e151df66eb50e9f..7b0a9dac7ae3177c4646194dfe585e313e691de1 100644 (file)
@@ -376,6 +376,7 @@ static int kxcjk1013_get_startup_times(struct kxcjk1013_data *data)
 
 static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on)
 {
+#ifdef CONFIG_PM
        int ret;
 
        if (on)
@@ -389,6 +390,7 @@ static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on)
                        "Failed: kxcjk1013_set_power_state for %d\n", on);
                return ret;
        }
+#endif
 
        return 0;
 }