From: Hartmut Knaack <knaack.h@gmx.de>
To: Irina Tirdea <irina.tirdea@intel.com>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: gyro: bmg160: only set power state if PM_RUNTIME is defined
Date: Sat, 06 Sep 2014 14:12:03 +0200 [thread overview]
Message-ID: <540AFA13.6010207@gmx.de> (raw)
In-Reply-To: <1409655759-28849-1-git-send-email-irina.tirdea@intel.com>
Irina Tirdea schrieb:
> 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.
Unless there is anything more to come, what about putting the #ifdef into first line inside bmg160_set_power_state() and just an #endif before the return 0 at the end? Saves 5 lines.
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/iio/gyro/bmg160.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
> index 7524698..e41d6b5 100644
> --- a/drivers/iio/gyro/bmg160.c
> +++ b/drivers/iio/gyro/bmg160.c
> @@ -235,6 +235,7 @@ static int bmg160_chip_init(struct bmg160_data *data)
> return 0;
> }
>
> +#ifdef CONFIG_PM_RUNTIME
> static int bmg160_set_power_state(struct bmg160_data *data, bool on)
> {
> int ret;
> @@ -254,6 +255,12 @@ static int bmg160_set_power_state(struct bmg160_data *data, bool on)
>
> return 0;
> }
> +#else
> +static int bmg160_set_power_state(struct bmg160_data *data, bool on)
> +{
> + return 0;
> +}
> +#endif
>
> static int bmg160_setup_any_motion_interrupt(struct bmg160_data *data,
> bool status)
next prev parent reply other threads:[~2014-09-06 12:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 11:02 [PATCH] iio: gyro: bmg160: only set power state if PM_RUNTIME is defined Irina Tirdea
2014-09-06 12:12 ` Hartmut Knaack [this message]
2014-09-08 13:50 ` Tirdea, Irina
2014-09-08 13:50 ` Tirdea, Irina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=540AFA13.6010207@gmx.de \
--to=knaack.h@gmx.de \
--cc=irina.tirdea@intel.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.