linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iio: gyro: bmg160: only set power state if PM_RUNTIME is defined
@ 2014-09-08 14:05 Irina Tirdea
  2014-09-09 22:14 ` Hartmut Knaack
  0 siblings, 1 reply; 3+ messages in thread
From: Irina Tirdea @ 2014-09-08 14:05 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald,
	Srinivas Pandruvada, linux-kernel, Irina Tirdea

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>
---

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(+)

diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
index 7524698..1f967e0d 100644
--- a/drivers/iio/gyro/bmg160.c
+++ b/drivers/iio/gyro/bmg160.c
@@ -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;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-14 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-08 14:05 [PATCH v2] iio: gyro: bmg160: only set power state if PM_RUNTIME is defined Irina Tirdea
2014-09-09 22:14 ` Hartmut Knaack
2014-09-14 17:30   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).