瀏覽代碼

iio: accel: BMC150: fix issues when CONFIG_PM_RUNTIME is not set

When CONFIG_PM_RUNTIME is not set, the following issues are seen:
 * warning message at compilation time:
    warning: 'bmc150_accel_get_startup_times' defined but not used [-Wunused-function]
 * bmc150_accel_set_power_state() will always fail and reading the
   accelerometer data is impossible;
   This occurs because of the call to pm_runtime_put_autosuspend calls
   __pm_runtime_suspend which returns -ENOSYS.

This commit fixes these.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Laurentiu Palcu 11 年之前
父節點
當前提交
b31b05cf62
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      drivers/iio/accel/bmc150-accel.c

+ 7 - 0
drivers/iio/accel/bmc150-accel.c

@@ -499,6 +499,7 @@ static int bmc150_accel_get_bw(struct bmc150_accel_data *data, int *val,
 	return -EINVAL;
 }
 
+#ifdef CONFIG_PM_RUNTIME
 static int bmc150_accel_get_startup_times(struct bmc150_accel_data *data)
 {
 	int i;
@@ -529,6 +530,12 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on)
 
 	return 0;
 }
+#else
+static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on)
+{
+	return 0;
+}
+#endif
 
 static int bmc150_accel_set_scale(struct bmc150_accel_data *data, int val)
 {