]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio: gyro: bmg160: only set power state if PM_RUNTIME is defined
authorIrina Tirdea <irina.tirdea@intel.com>
Sat, 9 Aug 2014 14:05:00 +0000 (15:05 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sun, 14 Sep 2014 17:29:19 +0000 (18:29 +0100)
When CONFIG_PM_RUNTIME is not defined and bmg160 tries to power
off the device, bmg160_set_power_state will call pm_runtime_put_autosuspend,
which is not implemented (wil return -ENOSYS).

Only call bmg160_set_power_state when CONFIG_PM_RUNTIME is defined.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/gyro/bmg160.c

index 80f92a65e020571375ec02ccd2405c838b6de085..99acf361aa530b00081eced4d9e9f8a7f8dccea4 100644 (file)
@@ -237,6 +237,7 @@ static int bmg160_chip_init(struct bmg160_data *data)
 
 static int bmg160_set_power_state(struct bmg160_data *data, bool on)
 {
+#ifdef CONFIG_PM_RUNTIME
        int ret;
 
        if (on)
@@ -251,6 +252,7 @@ static int bmg160_set_power_state(struct bmg160_data *data, bool on)
                        "Failed: bmg160_set_power_state for %d\n", on);
                return ret;
        }
+#endif
 
        return 0;
 }