Skip to content

Commit

Permalink
iio: gyro: bmg160: only set power state if PM_RUNTIME is defined
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Irina Tirdea authored and Jonathan Cameron committed Sep 14, 2014
1 parent c686137 commit ef1c6b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/iio/gyro/bmg160.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit ef1c6b2

Please sign in to comment.