From: Jon Hunter <jonathanh@nvidia.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume
Date: Tue, 8 Mar 2016 17:18:06 +0000 [thread overview]
Message-ID: <56DF094E.4030809@nvidia.com> (raw)
In-Reply-To: <1457105585-25157-1-git-send-email-jonathanh@nvidia.com>
On 04/03/16 15:33, Jon Hunter wrote:
> The functions pm_clk_suspend() and pm_clk_resume() cannot be used
> directly within the main body of a function, because when CONFIG_PM_CLK
> is not defined the functions are defined as NULL and this will lead to
> a compilation error.
>
> Add stubs functions for pm_clk_suspend() and pm_clk_resume() so that
> these functions may be called directly.
>
> Please note that these functions are currently assigned to function
> pointers in the PM domain core and so to avoid have a valid function
> pointer defined when CONFIG_PM_CLK is not defined, define
> GENPD_FLAG_PM_CLK as 0 when CONFIG_PM_CLK is not defined to ensure
> the stubs are not populated as valid function pointers.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> include/linux/pm_clock.h | 10 ++++++++--
> include/linux/pm_domain.h | 4 ++++
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h
> index 25266c600021..ffefbf2df1aa 100644
> --- a/include/linux/pm_clock.h
> +++ b/include/linux/pm_clock.h
> @@ -72,8 +72,14 @@ static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
> static inline void pm_clk_remove(struct device *dev, const char *con_id)
> {
> }
> -#define pm_clk_suspend NULL
> -#define pm_clk_resume NULL
> +static inline int pm_clk_suspend(struct device *dev)
> +{
> + return -EINVAL;
> +}
> +static inline int pm_clk_resume(struct device *dev)
> +{
> + return -EINVAL;
> +}
> #endif
>
> #ifdef CONFIG_HAVE_CLK
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 49cd8890b873..1074c2073df8 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -17,7 +17,11 @@
> #include <linux/notifier.h>
>
> /* Defines used for the flags field in the struct generic_pm_domain */
> +#ifdef CONFIG_PM_CLK
> #define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */
> +#else
> +#define GENPD_FLAG_PM_CLK 0
> +#endif
>
> #define GENPD_MAX_NUM_STATES 8 /* Number of possible low power states */
Thinking about this some more, the alternative is for drivers using
PM_CLK to select it. Would that be appropriate? If so, we would not need
these stubs.
Cheers
Jon
next prev parent reply other threads:[~2016-03-08 17:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-04 15:33 [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume Jon Hunter
[not found] ` <1457105585-25157-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-04 15:33 ` [PATCH 2/2] PM / clk: Add support for obtaining clocks from device-tree Jon Hunter
2016-03-07 8:48 ` Geert Uytterhoeven
2016-03-07 10:45 ` Jon Hunter
[not found] ` <56DD5BE6.1070905-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-07 11:06 ` Geert Uytterhoeven
2016-03-08 17:18 ` Jon Hunter [this message]
2016-03-08 22:58 ` [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume Rafael J. Wysocki
2016-03-09 10:58 ` Jon Hunter
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=56DF094E.4030809@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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).