Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1348755

Re: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions

From Vinod Koul <vinod.koul@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
Date 2016-03-03 04:50 +0100
Message-ID <r8sr0-13R-9@gated-at.bofh.it> (permalink)
References <r8hvz-1yT-3@gated-at.bofh.it> <r8hvB-1yT-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 02, 2016 at 04:58:58PM +0100, Arnd Bergmann wrote:
> The sirf dma driver uses #ifdef to check for CONFIG_PM_SLEEP
> for its suspend/resume code but then has no #ifdef for the
> respective runtime PM code, so we get a warning if CONFIG_PM
> is disabled altogether:
> 
> drivers/dma/sirf-dma.c:1000:12: error: 'sirfsoc_dma_runtime_resume' defined but not used [-Werror=unused-function]
> 
> This removes the existing #ifdef and instead uses __maybe_unused
> annotations for all four functions to let the compiler know it
> can silently drop the function definition.

Hi Arnd,

Rather than telling compiler that this maybe used why not add ifdef for it's
suspend/resume as well, what are the demerits of that approach?

-- 
~Vinod

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/dma/sirf-dma.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
> index 22ea2419ee56..e48350e65089 100644
> --- a/drivers/dma/sirf-dma.c
> +++ b/drivers/dma/sirf-dma.c
> @@ -989,7 +989,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)
>  	return 0;
>  }
>  
> -static int sirfsoc_dma_runtime_suspend(struct device *dev)
> +static int __maybe_unused sirfsoc_dma_runtime_suspend(struct device *dev)
>  {
>  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
>  
> @@ -997,7 +997,7 @@ static int sirfsoc_dma_runtime_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int sirfsoc_dma_runtime_resume(struct device *dev)
> +static int __maybe_unused sirfsoc_dma_runtime_resume(struct device *dev)
>  {
>  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
>  	int ret;
> @@ -1010,8 +1010,7 @@ static int sirfsoc_dma_runtime_resume(struct device *dev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int sirfsoc_dma_pm_suspend(struct device *dev)
> +static int __maybe_unused sirfsoc_dma_pm_suspend(struct device *dev)
>  {
>  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
>  	struct sirfsoc_dma_regs *save = &sdma->regs_save;
> @@ -1062,7 +1061,7 @@ static int sirfsoc_dma_pm_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int sirfsoc_dma_pm_resume(struct device *dev)
> +static int __maybe_unused sirfsoc_dma_pm_resume(struct device *dev)
>  {
>  	struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
>  	struct sirfsoc_dma_regs *save = &sdma->regs_save;
> @@ -1121,7 +1120,6 @@ static int sirfsoc_dma_pm_resume(struct device *dev)
>  
>  	return 0;
>  }
> -#endif
>  
>  static const struct dev_pm_ops sirfsoc_dma_pm_ops = {
>  	SET_RUNTIME_PM_OPS(sirfsoc_dma_runtime_suspend, sirfsoc_dma_runtime_resume, NULL)
> -- 
> 2.7.0
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
  [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    RE: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide  pm functions Frank Li <frank.li@nxp.com> - 2016-03-02 17:40 +0100
      Re: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide  pm functions Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-03-02 18:20 +0100
  [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to  hide pm functions Sebastian Reichel <sre@kernel.org> - 2016-03-03 15:30 +0100
  [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_ Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
  [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide  pm functions Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-03-02 18:20 +0100
  Re: [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm  functions Nicolas Ferre <nicolas.ferre@atmel.com> - 2016-03-02 17:10 +0100
  [PATCH 13/14] [media] omap3isp: use IS_ENABLED() to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
  [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions Vinod Koul <vinod.koul@intel.com> - 2016-03-03 04:50 +0100
      Re: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-03 13:40 +0100
  [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm  functions Ludovic Desroches <ludovic.desroches@atmel.com> - 2016-03-02 17:50 +0100
  [PATCH 09/14] amd-xgbe: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
  [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide  pm functions Sebastian Reichel <sre@kernel.org> - 2016-03-03 15:30 +0100
  [PATCH 14/14] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
  [PATCH 08/14] scsi: mvumi: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 08/14] scsi: mvumi: use __maybe_unused to hide pm  functions Johannes Thumshirn <jthumshirn@suse.de> - 2016-03-03 09:40 +0100
  [PATCH 02/14] irqchip: st: use __maybe_unused to hide st_irq_syscfg_resume Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
  [PATCH 07/14] hw_random: exynos: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 17:10 +0100
    Re: [PATCH 07/14] hw_random: exynos: use __maybe_unused to hide pm  functions Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-03 00:50 +0100

csiph-web