Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753004AbcCIK60 (ORCPT ); Wed, 9 Mar 2016 05:58:26 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:17451 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753052AbcCIK6Q (ORCPT ); Wed, 9 Mar 2016 05:58:16 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Wed, 09 Mar 2016 02:56:55 -0800 Subject: Re: [PATCH 1/2] PM / clk: Add stubs for pm_clk_suspend/resume To: "Rafael J. Wysocki" References: <1457105585-25157-1-git-send-email-jonathanh@nvidia.com> <56DF094E.4030809@nvidia.com> <4293335.ArkqpzdFRe@vostro.rjw.lan> CC: , , From: Jon Hunter Message-ID: <56E001C1.2050905@nvidia.com> Date: Wed, 9 Mar 2016 10:58:09 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <4293335.ArkqpzdFRe@vostro.rjw.lan> X-Originating-IP: [10.21.132.159] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2648 Lines: 73 On 08/03/16 22:58, Rafael J. Wysocki wrote: > 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 >>> --- >>> 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 >>> >>> /* 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. Ok, thanks. I will drop this patch for now and update the 2nd patch of this series to address the comments from Geert. Cheers Jon