Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1353467
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume |
| Date | 2016-03-09 00:00 +0100 |
| Message-ID | <rayLE-7lC-7@gated-at.bofh.it> (permalink) |
| References | <r8ZZD-gW-13@gated-at.bofh.it> <ratsB-3P7-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tuesday, March 08, 2016 05:18:06 PM Jon Hunter wrote:
>
> 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.
Well, I don't see why it might not be appropriate.
Thanks,
Rafael
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume Jon Hunter <jonathanh@nvidia.com> - 2016-03-04 16:40 +0100
[PATCH 2/2] PM / clk: Add support for obtaining clocks from device-tree Jon Hunter <jonathanh@nvidia.com> - 2016-03-04 16:40 +0100
Re: [PATCH 2/2] PM / clk: Add support for obtaining clocks from device-tree Geert Uytterhoeven <geert@linux-m68k.org> - 2016-03-07 09:50 +0100
Re: [PATCH 2/2] PM / clk: Add support for obtaining clocks from device-tree Jon Hunter <jonathanh@nvidia.com> - 2016-03-07 11:50 +0100
Re: [PATCH 2/2] PM / clk: Add support for obtaining clocks from device-tree Geert Uytterhoeven <geert@linux-m68k.org> - 2016-03-07 12:10 +0100
Re: [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume Jon Hunter <jonathanh@nvidia.com> - 2016-03-08 18:20 +0100
Re: [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-03-09 00:00 +0100
Re: [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume Jon Hunter <jonathanh@nvidia.com> - 2016-03-09 12:00 +0100
csiph-web