From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] hwmon: tmp102: add hibernation callbacks
Date: Mon, 2 Feb 2015 09:23:11 -0800 [thread overview]
Message-ID: <20150202172311.GA22638@roeck-us.net> (raw)
In-Reply-To: <1422897271-24068-1-git-send-email-grygorii.strashko@linaro.org>
On Mon, Feb 02, 2015 at 07:14:31PM +0200, grygorii.strashko at linaro.org wrote:
> From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
>
> Setting a dev_pm_ops suspend/resume pair but not a set of
> hibernation functions means those pm functions will not be
> called upon hibernation.
> Fix this by using SIMPLE_DEV_PM_OPS, which appropriately
> assigns the suspend and hibernation handlers.
>
> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
> ---
> drivers/hwmon/tmp102.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
> index 6748b45..4f790f5 100644
> --- a/drivers/hwmon/tmp102.c
> +++ b/drivers/hwmon/tmp102.c
> @@ -281,17 +281,10 @@ static int tmp102_resume(struct device *dev)
> config &= ~TMP102_CONF_SD;
> return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config);
> }
> -
> -static const struct dev_pm_ops tmp102_dev_pm_ops = {
> - .suspend = tmp102_suspend,
> - .resume = tmp102_resume,
> -};
> -
> -#define TMP102_DEV_PM_OPS (&tmp102_dev_pm_ops)
> -#else
> -#define TMP102_DEV_PM_OPS NULL
> #endif /* CONFIG_PM */
>
> +SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
> +
SIMPLE_DEV_PM_OPS is defined in the context of CONFIG_PM_SLEEP,
while tmp102_suspend and tmp102_resume above are defined in the
context of CONFIG_PM. This will result in situations where the
functions are defined but not used, resulting in build warnings.
Please change the condition in the driver to #ifdef CONFIG_PM_SLEEP
to avoid this problem.
Thanks,
Guenter
prev parent reply other threads:[~2015-02-02 17:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 17:14 [PATCH] hwmon: tmp102: add hibernation callbacks grygorii.strashko at linaro.org
2015-02-02 17:23 ` Guenter Roeck [this message]
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=20150202172311.GA22638@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-arm-kernel@lists.infradead.org \
/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 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).