iio: gyro: bmg160: only set power state if PM_RUNTIME is defined
PATCH v2 1/1 iio: gyro: bmg160: only set power state if PM_RUNTIME is defined
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.
---
Changes in v2:
- moved ifdef CONFIG_PM_RUNTIME inside bmg160_set_power_state as
Hartmut Knaack suggested
drivers/iio/gyro/bmg160.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/gyro/bmg160.c +2 -0
@@ -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 ; }
Signature · 1 line
1.7.9.5
Irina Tirdea schrieb, Am 08.09.2014 16:05:
Quoted 7 lines
When
CONFIG_PM_RUNTIMEis not defined and bmg160 tries to power off the device,bmg160_set_power_statewill callpm_runtime_put_autosuspend, which is not implemented (wil return-ENOSYS).Only call
bmg160_set_power_statewhenCONFIG_PM_RUNTIMEis defined.Signed-off-by Irina Tirdea <[email protected]>
Quoted 30 lines
---
Changes in v2:
- moved ifdefCONFIG_PM_RUNTIMEinsidebmg160_set_power_stateas
Hartmut Knaack suggesteddrivers/iio/gyro/bmg160.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/gyro/bmg160.c +2
-0@@ -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 ; }
Jonathan Cameron
maintainerQuoted 9 lines · Hartmut Knaack
Irina Tirdea schrieb, Am 08.09.2014 16:05:
Quoted 7 lines
When
CONFIG_PM_RUNTIMEis not defined and bmg160 tries to power off the device,bmg160_set_power_statewill callpm_runtime_put_autosuspend, which is not implemented (wil return-ENOSYS).Only call
bmg160_set_power_statewhenCONFIG_PM_RUNTIMEis defined.Signed-off-by Irina Tirdea <[email protected]>Acked-by Hartmut Knaack <[email protected]>
Applied to the togreg branch of iio.git. Initially pushed out as testing for the autobuilders to play.
Thanks,
Jonathan
Quoted 31 lines
Quoted 30 lines
---
Changes in v2:
- moved ifdefCONFIG_PM_RUNTIMEinsidebmg160_set_power_stateas
Hartmut Knaack suggesteddrivers/iio/gyro/bmg160.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/gyro/bmg160.c +2
-0@@ -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 ; }