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


Groups > linux.kernel > #1348247 > unrolled thread

[PATCH 00/14] drivers: use __maybe_unused to hide pm functions

Started byArnd Bergmann <arnd@arndb.de>
First post2016-03-02 17:10 +0100
Last post2016-03-03 00:50 +0100
Articles 20 on this page of 25 — 9 participants

Back to article view | Back to linux.kernel


Contents

  [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

Page 1 of 2  [1] 2  Next page →


#1348247 — [PATCH 00/14] drivers: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 00/14] drivers: use __maybe_unused to hide pm functions
Message-ID<r8hvz-1yT-3@gated-at.bofh.it>
I found many variations of the bug in these device drivers (and some
USB drivers I already send patches for in a separate series).

In each case, the power management operations structure conditionally
references suspend/resume functions, but the functions are hidden
in an incorrect #ifdef or not hidden at all.

We could try to correct the #ifdefs, but it seems easier to just
mark those functions as __maybe_unused, which has the same effect
but provides better compile-time test coverage and (subjectively)
looks a bit nicer.

I have a patch series that avoids all warnings in ARM randconfig
builds, and I have verified that all these patches fix a warning that
is still present in today's linux-next, and that they do not
introduce new warnings in any configuration I found.

Note that all these drivers are ARM specific, so I assume that
all portable drivers got fixed already when someone rand into
the problem on x86.

There are no dependencies between the patches, so I'd appreciate
subsystem maintainers to put them directly into their git trees.

	Arnd

Arnd Bergmann (14):
  pinctrl: at91: use __maybe_unused to hide pm functions
  irqchip: st: use __maybe_unused to hide st_irq_syscfg_resume
  power: ipaq-micro-battery: use __maybe_unused to hide pm functions
  power: pm2301-charger: use __maybe_unused to hide pm functions
  mfd: ipaq-micro: use __maybe_unused to hide pm functions
  dma: sirf: use __maybe_unused to hide pm functions
  hw_random: exynos: use __maybe_unused to hide pm functions
  scsi: mvumi: use __maybe_unused to hide pm functions
  amd-xgbe: use __maybe_unused to hide pm functions
  wireless: cw1200: use __maybe_unused to hide pm functions_
  input: spear-keyboard: use __maybe_unused to hide pm functions
  keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
  [media] omap3isp: use IS_ENABLED() to hide pm functions
  ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume

 drivers/char/hw_random/exynos-rng.c         | 10 ++++------
 drivers/dma/sirf-dma.c                      | 10 ++++------
 drivers/input/keyboard/snvs_pwrkey.c        |  4 ++--
 drivers/input/keyboard/spear-keyboard.c     |  6 ++----
 drivers/irqchip/irq-st.c                    |  2 +-
 drivers/media/platform/omap3isp/isp.c       | 13 +------------
 drivers/mfd/ipaq-micro.c                    |  2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-main.c   |  6 ++----
 drivers/net/wireless/st/cw1200/cw1200_spi.c |  9 ++-------
 drivers/net/wireless/st/cw1200/pm.h         |  9 +++++++--
 drivers/pinctrl/pinctrl-at91-pio4.c         |  4 ++--
 drivers/power/ipaq_micro_battery.c          |  4 ++--
 drivers/power/pm2301_charger.c              | 22 ++++++----------------
 drivers/scsi/mvumi.c                        |  4 ++--
 sound/soc/rockchip/rockchip_spdif.c         |  4 ++--
 15 files changed, 40 insertions(+), 69 deletions(-)

-- 
2.7.0
Cc: herbert@gondor.apana.org.au
Cc: k.kozlowski@samsung.com
Cc: dan.j.williams@intel.com
Cc: vinod.koul@intel.com
Cc: baohua@kernel.org
Cc: dmitry.torokhov@gmail.com
Cc: tglx@linutronix.de
Cc: jason@lakedaemon.net
Cc: marc.zyngier@arm.com
Cc: laurent.pinchart@ideasonboard.com
Cc: mchehab@osg.samsung.com
Cc: lee.jones@linaro.org
Cc: kvalo@codeaurora.org
Cc: ludovic.desroches@atmel.com
Cc: linus.walleij@linaro.org
Cc: sre@kernel.org
Cc: dbaryshkov@gmail.com
Cc: JBottomley@odin.com
Cc: martin.petersen@oracle.com
Cc: broonie@kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: dmaengine@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: linux-gpio@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: alsa-devel@alsa-project.org
Cc: linux-rockchip@lists.infradead.org

[toc] | [next] | [standalone]


#1348248 — [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
Message-ID<r8hvA-1yT-9@gated-at.bofh.it>
In reply to#1348247
The SNVS power key driver has suspend/resume functions that
are accessed using SIMPLE_DEV_PM_OPS, which hide the reference
when CONFIG_PM_SLEEP is not set, resulting in a warning about
unused functions:

drivers/input/keyboard/snvs_pwrkey.c:183:12: error: 'imx_snvs_pwrkey_suspend' defined but not used [-Werror=unused-function]
drivers/input/keyboard/snvs_pwrkey.c:194:12: error: 'imx_snvs_pwrkey_resume' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations to let the compiler know
it can silently drop the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/keyboard/snvs_pwrkey.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 9adf13a5864a..b0ffadeb208c 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -180,7 +180,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int imx_snvs_pwrkey_suspend(struct device *dev)
+static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
@@ -191,7 +191,7 @@ static int imx_snvs_pwrkey_suspend(struct device *dev)
 	return 0;
 }
 
-static int imx_snvs_pwrkey_resume(struct device *dev)
+static int __maybe_unused imx_snvs_pwrkey_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1348311 — RE: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions

FromFrank Li <frank.li@nxp.com>
Date2016-03-02 17:40 +0100
SubjectRE: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
Message-ID<r8hYC-1Lj-37@gated-at.bofh.it>
In reply to#1348248

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Wednesday, March 02, 2016 9:59 AM
> To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org; Arnd Bergmann <arnd@arndb.de>;
> Shawn Guo <shawnguo@kernel.org>; b38343@freescale.com; Javier
> Martinez Canillas <javier@osg.samsung.com>; Frank Li
> <Frank.Li@freescale.com>; linux-input@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide
> pm functions
> 
> The SNVS power key driver has suspend/resume functions that are accessed
> using SIMPLE_DEV_PM_OPS, which hide the reference when
> CONFIG_PM_SLEEP is not set, resulting in a warning about unused functions:
> 
> drivers/input/keyboard/snvs_pwrkey.c:183:12: error:
> 'imx_snvs_pwrkey_suspend' defined but not used [-Werror=unused-function]
> drivers/input/keyboard/snvs_pwrkey.c:194:12: error:
> 'imx_snvs_pwrkey_resume' defined but not used [-Werror=unused-function]
> 
> This adds __maybe_unused annotations to let the compiler know it can
> silently drop the function definition.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/input/keyboard/snvs_pwrkey.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c
> b/drivers/input/keyboard/snvs_pwrkey.c
> index 9adf13a5864a..b0ffadeb208c 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -180,7 +180,7 @@ static int imx_snvs_pwrkey_probe(struct
> platform_device *pdev)
>  	return 0;
>  }
> 
> -static int imx_snvs_pwrkey_suspend(struct device *dev)
> +static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev); @@ -
> 191,7 +191,7 @@ static int imx_snvs_pwrkey_suspend(struct device *dev)
>  	return 0;
>  }
> 
> -static int imx_snvs_pwrkey_resume(struct device *dev)
> +static int __maybe_unused imx_snvs_pwrkey_resume(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
> --
> 2.7.0

[toc] | [prev] | [next] | [standalone]


#1348341 — Re: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2016-03-02 18:20 +0100
SubjectRe: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
Message-ID<r8iBj-2eO-9@gated-at.bofh.it>
In reply to#1348311
On Wed, Mar 02, 2016 at 04:04:46PM +0000, Frank Li wrote:
> 
> 
> > -----Original Message-----
> > From: Arnd Bergmann [mailto:arnd@arndb.de]
> > Sent: Wednesday, March 02, 2016 9:59 AM
> > To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: linux-arm-kernel@lists.infradead.org; Arnd Bergmann <arnd@arndb.de>;
> > Shawn Guo <shawnguo@kernel.org>; b38343@freescale.com; Javier
> > Martinez Canillas <javier@osg.samsung.com>; Frank Li
> > <Frank.Li@freescale.com>; linux-input@vger.kernel.org; linux-
> > kernel@vger.kernel.org
> > Subject: [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide
> > pm functions
> > 
> > The SNVS power key driver has suspend/resume functions that are accessed
> > using SIMPLE_DEV_PM_OPS, which hide the reference when
> > CONFIG_PM_SLEEP is not set, resulting in a warning about unused functions:
> > 
> > drivers/input/keyboard/snvs_pwrkey.c:183:12: error:
> > 'imx_snvs_pwrkey_suspend' defined but not used [-Werror=unused-function]
> > drivers/input/keyboard/snvs_pwrkey.c:194:12: error:
> > 'imx_snvs_pwrkey_resume' defined but not used [-Werror=unused-function]
> > 
> > This adds __maybe_unused annotations to let the compiler know it can
> > silently drop the function definition.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Acked-by: Frank Li <Frank.Li@nxp.com>

Applied, thank you.

> 
> > ---
> >  drivers/input/keyboard/snvs_pwrkey.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/input/keyboard/snvs_pwrkey.c
> > b/drivers/input/keyboard/snvs_pwrkey.c
> > index 9adf13a5864a..b0ffadeb208c 100644
> > --- a/drivers/input/keyboard/snvs_pwrkey.c
> > +++ b/drivers/input/keyboard/snvs_pwrkey.c
> > @@ -180,7 +180,7 @@ static int imx_snvs_pwrkey_probe(struct
> > platform_device *pdev)
> >  	return 0;
> >  }
> > 
> > -static int imx_snvs_pwrkey_suspend(struct device *dev)
> > +static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev)
> >  {
> >  	struct platform_device *pdev = to_platform_device(dev);
> >  	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev); @@ -
> > 191,7 +191,7 @@ static int imx_snvs_pwrkey_suspend(struct device *dev)
> >  	return 0;
> >  }
> > 
> > -static int imx_snvs_pwrkey_resume(struct device *dev)
> > +static int __maybe_unused imx_snvs_pwrkey_resume(struct device *dev)
> >  {
> >  	struct platform_device *pdev = to_platform_device(dev);
> >  	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
> > --
> > 2.7.0
> 

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1348250 — [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions
Message-ID<r8hvA-1yT-15@gated-at.bofh.it>
In reply to#1348247
The ipaq micro battery driver has suspend/resume functions that
are accessed using SIMPLE_DEV_PM_OPS, which hide the reference
when CONFIG_PM_SLEEP is not set, resulting in a warning about
unused functions:

drivers/power/ipaq_micro_battery.c:284:12: error: 'micro_batt_suspend' defined but not used [-Werror=unused-function]
drivers/power/ipaq_micro_battery.c:292:12: error: 'micro_batt_resume' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations to let the compiler know
it can silently drop the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/power/ipaq_micro_battery.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/ipaq_micro_battery.c b/drivers/power/ipaq_micro_battery.c
index f03014ea1dc4..3f314b1a30d7 100644
--- a/drivers/power/ipaq_micro_battery.c
+++ b/drivers/power/ipaq_micro_battery.c
@@ -281,7 +281,7 @@ static int micro_batt_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int micro_batt_suspend(struct device *dev)
+static int __maybe_unused micro_batt_suspend(struct device *dev)
 {
 	struct micro_battery *mb = dev_get_drvdata(dev);
 
@@ -289,7 +289,7 @@ static int micro_batt_suspend(struct device *dev)
 	return 0;
 }
 
-static int micro_batt_resume(struct device *dev)
+static int __maybe_unused micro_batt_resume(struct device *dev)
 {
 	struct micro_battery *mb = dev_get_drvdata(dev);
 
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1349220 — Re: [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions

FromSebastian Reichel <sre@kernel.org>
Date2016-03-03 15:30 +0100
SubjectRe: [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions
Message-ID<r8Cqo-8hu-39@gated-at.bofh.it>
In reply to#1348250

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Wed, Mar 02, 2016 at 04:58:55PM +0100, Arnd Bergmann wrote:
> The ipaq micro battery driver has suspend/resume functions that
> are accessed using SIMPLE_DEV_PM_OPS, which hide the reference
> when CONFIG_PM_SLEEP is not set, resulting in a warning about
> unused functions:
> 
> drivers/power/ipaq_micro_battery.c:284:12: error: 'micro_batt_suspend' defined but not used [-Werror=unused-function]
> drivers/power/ipaq_micro_battery.c:292:12: error: 'micro_batt_resume' defined but not used [-Werror=unused-function]
> 
> This adds __maybe_unused annotations to let the compiler know
> it can silently drop the function definition.

Thanks, queued.

-- Sebastian

[toc] | [prev] | [next] | [standalone]


#1348252 — [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_
Message-ID<r8hvA-1yT-23@gated-at.bofh.it>
In reply to#1348247
The cw1200 uses #ifdef to check for CONFIG_PM, but then
uses SIMPLE_DEV_PM_OPS, which leaves the references out when
CONFIG_PM_SLEEP is not defined, so we get a warning with
PM=y && PM_SLEEP=n:

drivers/net/wireless/st/cw1200/cw1200_spi.c:450:12: error: 'cw1200_spi_suspend' defined but not used [-Werror=unused-function]

This removes the incorrect #ifdef and instead uses a __maybe_unused
annotation to let the compiler know it can silently drop
the function definition.

For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
to avoid defining the structure when CONFIG_PM is not set without
the #ifdef.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/st/cw1200/cw1200_spi.c | 9 ++-------
 drivers/net/wireless/st/cw1200/pm.h         | 9 +++++++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c
index a740083634d8..63f95e9c2992 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c
@@ -446,8 +446,7 @@ static int cw1200_spi_disconnect(struct spi_device *func)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int cw1200_spi_suspend(struct device *dev)
+static int __maybe_unused cw1200_spi_suspend(struct device *dev)
 {
 	struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));
 
@@ -460,16 +459,12 @@ static int cw1200_spi_suspend(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(cw1200_pm_ops, cw1200_spi_suspend, NULL);
 
-#endif
-
 static struct spi_driver spi_driver = {
 	.probe		= cw1200_spi_probe,
 	.remove		= cw1200_spi_disconnect,
 	.driver = {
 		.name		= "cw1200_wlan_spi",
-#ifdef CONFIG_PM
-		.pm		= &cw1200_pm_ops,
-#endif
+		.pm		= IS_ENABLED(CONFIG_PM) ? &cw1200_pm_ops : NULL,
 	},
 };
 
diff --git a/drivers/net/wireless/st/cw1200/pm.h b/drivers/net/wireless/st/cw1200/pm.h
index 3ed90ff22bb8..534548470ebc 100644
--- a/drivers/net/wireless/st/cw1200/pm.h
+++ b/drivers/net/wireless/st/cw1200/pm.h
@@ -31,13 +31,18 @@ int cw1200_pm_init(struct cw1200_pm_state *pm,
 void cw1200_pm_deinit(struct cw1200_pm_state *pm);
 int cw1200_wow_suspend(struct ieee80211_hw *hw,
 		       struct cfg80211_wowlan *wowlan);
-int cw1200_wow_resume(struct ieee80211_hw *hw);
 int cw1200_can_suspend(struct cw1200_common *priv);
+int cw1200_wow_resume(struct ieee80211_hw *hw);
 void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
 			  unsigned long tmo);
 #else
 static inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
-					unsigned long tmo) {
+					unsigned long tmo)
+{
+}
+static inline int cw1200_can_suspend(struct cw1200_common *priv)
+{
+	return 0;
 }
 #endif
 #endif
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1348254 — [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions
Message-ID<r8hvA-1yT-27@gated-at.bofh.it>
In reply to#1348247
The spear keyboard driver uses #ifdef CONFIG_PM to hide its
power management functions, but then uses references from
SIMPLE_DEV_PM_OPS that are only present if both CONFIG_PM
and CONFIG_PM_SLEEP are set, resulting in a warning about unused
functions:

drivers/input/keyboard/spear-keyboard.c:292:12: error: 'spear_kbd_suspend' defined but not used [-Werror=unused-function]
drivers/input/keyboard/spear-keyboard.c:345:12: error: 'spear_kbd_resume' defined but not used [-Werror=unused-function]

This removes the #ifdef and instead uses a __maybe_unused
annotation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/keyboard/spear-keyboard.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 623d451767e3..8083eaa0524a 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -288,8 +288,7 @@ static int spear_kbd_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int spear_kbd_suspend(struct device *dev)
+static int __maybe_unused spear_kbd_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct spear_kbd *kbd = platform_get_drvdata(pdev);
@@ -342,7 +341,7 @@ static int spear_kbd_suspend(struct device *dev)
 	return 0;
 }
 
-static int spear_kbd_resume(struct device *dev)
+static int __maybe_unused spear_kbd_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct spear_kbd *kbd = platform_get_drvdata(pdev);
@@ -368,7 +367,6 @@ static int spear_kbd_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(spear_kbd_pm_ops, spear_kbd_suspend, spear_kbd_resume);
 
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1348343 — Re: [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2016-03-02 18:20 +0100
SubjectRe: [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions
Message-ID<r8iBk-2eO-15@gated-at.bofh.it>
In reply to#1348254
On Wed, Mar 02, 2016 at 04:59:03PM +0100, Arnd Bergmann wrote:
> The spear keyboard driver uses #ifdef CONFIG_PM to hide its
> power management functions, but then uses references from
> SIMPLE_DEV_PM_OPS that are only present if both CONFIG_PM
> and CONFIG_PM_SLEEP are set, resulting in a warning about unused
> functions:
> 
> drivers/input/keyboard/spear-keyboard.c:292:12: error: 'spear_kbd_suspend' defined but not used [-Werror=unused-function]
> drivers/input/keyboard/spear-keyboard.c:345:12: error: 'spear_kbd_resume' defined but not used [-Werror=unused-function]
> 
> This removes the #ifdef and instead uses a __maybe_unused
> annotation.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thank you.

> ---
>  drivers/input/keyboard/spear-keyboard.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
> index 623d451767e3..8083eaa0524a 100644
> --- a/drivers/input/keyboard/spear-keyboard.c
> +++ b/drivers/input/keyboard/spear-keyboard.c
> @@ -288,8 +288,7 @@ static int spear_kbd_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> -static int spear_kbd_suspend(struct device *dev)
> +static int __maybe_unused spear_kbd_suspend(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct spear_kbd *kbd = platform_get_drvdata(pdev);
> @@ -342,7 +341,7 @@ static int spear_kbd_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int spear_kbd_resume(struct device *dev)
> +static int __maybe_unused spear_kbd_resume(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct spear_kbd *kbd = platform_get_drvdata(pdev);
> @@ -368,7 +367,6 @@ static int spear_kbd_resume(struct device *dev)
>  
>  	return 0;
>  }
> -#endif
>  
>  static SIMPLE_DEV_PM_OPS(spear_kbd_pm_ops, spear_kbd_suspend, spear_kbd_resume);
>  
> -- 
> 2.7.0
> 

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1348256 — Re: [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions

FromNicolas Ferre <nicolas.ferre@atmel.com>
Date2016-03-02 17:10 +0100
SubjectRe: [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
Message-ID<r8hvB-1yT-31@gated-at.bofh.it>
In reply to#1348247
Le 02/03/2016 16:58, Arnd Bergmann a écrit :
> The at91-pio4 pinctrl driver uses SET_SYSTEM_SLEEP_PM_OPS() to
> conditionally set the correct suspend/resume options, but they
> become unused when CONFIG_PM is disabled:
> 
> drivers/pinctrl/pinctrl-at91-pio4.c:827:12: error: 'atmel_pctrl_suspend' defined but not used [-Werror=unused-function]
> drivers/pinctrl/pinctrl-at91-pio4.c:847:12: error: 'atmel_pctrl_resume' defined but not used [-Werror=unused-function]
> 
> This adds __maybe_unused annotations so the compiler knows
> it can silently drop them instead of warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Indeed, nice like this:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks, bye.


> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index ee69db6ae1c7..4429312e848d 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -824,7 +824,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {
>  	.pmxops		= &atmel_pmxops,
>  };
>  
> -static int atmel_pctrl_suspend(struct device *dev)
> +static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> @@ -844,7 +844,7 @@ static int atmel_pctrl_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int atmel_pctrl_resume(struct device *dev)
> +static int __maybe_unused atmel_pctrl_resume(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> 


-- 
Nicolas Ferre

[toc] | [prev] | [next] | [standalone]


#1348257 — [PATCH 13/14] [media] omap3isp: use IS_ENABLED() to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 13/14] [media] omap3isp: use IS_ENABLED() to hide pm functions
Message-ID<r8hvC-1yT-37@gated-at.bofh.it>
In reply to#1348247
The omap3isp driver hides is power management functions using #ifdef
but it fails to hide the isp_suspend_modules/isp_resume_modules
functions in the same way, which leads to a build warning when
CONFIG_PM is disabled:

drivers/media/platform/omap3isp/isp.c:1183:12: error: 'isp_suspend_modules' defined but not used [-Werror=unused-function]
drivers/media/platform/omap3isp/isp.c:1217:13: error: 'isp_resume_modules' defined but not used [-Werror=unused-function]

As the driver manually defines its dev_pm_ops structure and all
members are NULL without CONFIG_PM, we can simply avoid referencing
the structure using an IS_ENABLED() check, and drop all the #ifdef
to avoid all warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/platform/omap3isp/isp.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index f9e5245f26ac..7f118baca270 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1713,8 +1713,6 @@ void omap3isp_print_status(struct isp_device *isp)
 	dev_dbg(isp->dev, "--------------------------------------------\n");
 }
 
-#ifdef CONFIG_PM
-
 /*
  * Power management support.
  *
@@ -1785,15 +1783,6 @@ static void isp_pm_complete(struct device *dev)
 	isp_resume_modules(isp);
 }
 
-#else
-
-#define isp_pm_prepare	NULL
-#define isp_pm_suspend	NULL
-#define isp_pm_resume	NULL
-#define isp_pm_complete	NULL
-
-#endif /* CONFIG_PM */
-
 static void isp_unregister_entities(struct isp_device *isp)
 {
 	omap3isp_csi2_unregister_entities(&isp->isp_csi2a);
@@ -2611,7 +2600,7 @@ static struct platform_driver omap3isp_driver = {
 	.id_table = omap3isp_id_table,
 	.driver = {
 		.name = "omap3isp",
-		.pm	= &omap3isp_pm_ops,
+		.pm	= IS_ENABLED(CONFIG_PM) ? &omap3isp_pm_ops : NULL,
 		.of_match_table = omap3isp_of_table,
 	},
 };
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1348258 — [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
Message-ID<r8hvB-1yT-35@gated-at.bofh.it>
In reply to#1348247
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.

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

[toc] | [prev] | [next] | [standalone]


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

FromVinod Koul <vinod.koul@intel.com>
Date2016-03-03 04:50 +0100
SubjectRe: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
Message-ID<r8sr0-13R-9@gated-at.bofh.it>
In reply to#1348258
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
> 

[toc] | [prev] | [next] | [standalone]


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

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-03 13:40 +0100
SubjectRe: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
Message-ID<r8AHV-77v-27@gated-at.bofh.it>
In reply to#1348755
On Thursday 03 March 2016 09:17:31 Vinod Koul wrote:
> 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?
> 

As I tried to explain in the cover letter, everyone gets the #ifdef
wrong, and the __maybe_unused annotation is harder to get wrong here.

This particular driver illustrates that well: sirfsoc_dma_remove()
calls sirfsoc_dma_runtime_suspend(), so we must hide the
resume function, but not suspend, and that is counterintuitive.

Other drivers have other problems, e.g. functions that get called
only from within the sections under an #ifdef, and then those
need the same #ifdef added, which gets even more complicated when
you have both runtime-pm and suspend support.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1348262 — [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
Message-ID<r8hvB-1yT-33@gated-at.bofh.it>
In reply to#1348247
The at91-pio4 pinctrl driver uses SET_SYSTEM_SLEEP_PM_OPS() to
conditionally set the correct suspend/resume options, but they
become unused when CONFIG_PM is disabled:

drivers/pinctrl/pinctrl-at91-pio4.c:827:12: error: 'atmel_pctrl_suspend' defined but not used [-Werror=unused-function]
drivers/pinctrl/pinctrl-at91-pio4.c:847:12: error: 'atmel_pctrl_resume' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations so the compiler knows
it can silently drop them instead of warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index ee69db6ae1c7..4429312e848d 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -824,7 +824,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {
 	.pmxops		= &atmel_pmxops,
 };
 
-static int atmel_pctrl_suspend(struct device *dev)
+static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
@@ -844,7 +844,7 @@ static int atmel_pctrl_suspend(struct device *dev)
 	return 0;
 }
 
-static int atmel_pctrl_resume(struct device *dev)
+static int __maybe_unused atmel_pctrl_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1348320 — Re: [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions

FromLudovic Desroches <ludovic.desroches@atmel.com>
Date2016-03-02 17:50 +0100
SubjectRe: [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
Message-ID<r8i8j-1OI-31@gated-at.bofh.it>
In reply to#1348262
On Wed, Mar 02, 2016 at 04:58:53PM +0100, Arnd Bergmann wrote:
> The at91-pio4 pinctrl driver uses SET_SYSTEM_SLEEP_PM_OPS() to
> conditionally set the correct suspend/resume options, but they
> become unused when CONFIG_PM is disabled:
> 
> drivers/pinctrl/pinctrl-at91-pio4.c:827:12: error: 'atmel_pctrl_suspend' defined but not used [-Werror=unused-function]
> drivers/pinctrl/pinctrl-at91-pio4.c:847:12: error: 'atmel_pctrl_resume' defined but not used [-Werror=unused-function]
> 
> This adds __maybe_unused annotations so the compiler knows
> it can silently drop them instead of warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Thanks

> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index ee69db6ae1c7..4429312e848d 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -824,7 +824,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {
>  	.pmxops		= &atmel_pmxops,
>  };
>  
> -static int atmel_pctrl_suspend(struct device *dev)
> +static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> @@ -844,7 +844,7 @@ static int atmel_pctrl_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int atmel_pctrl_resume(struct device *dev)
> +static int __maybe_unused atmel_pctrl_resume(struct device *dev)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> -- 
> 2.7.0
> 

[toc] | [prev] | [next] | [standalone]


#1348266 — [PATCH 09/14] amd-xgbe: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 09/14] amd-xgbe: use __maybe_unused to hide pm functions
Message-ID<r8hvC-1yT-53@gated-at.bofh.it>
In reply to#1348247
The amd-xgbe ethernet driver hides its suspend/resume functions
in #ifdef CONFIG_PM, but uses SIMPLE_DEV_PM_OPS() to make the
reference conditional on CONFIG_PM_SLEEP, which results in a
warning when PM_SLEEP is not set but PM is:

drivers/net/ethernet/amd/xgbe/xgbe-main.c:833:12: warning: 'xgbe_suspend' defined but not used [-Wunused-function]
drivers/net/ethernet/amd/xgbe/xgbe-main.c:853:12: warning: 'xgbe_resume' defined but not used [-Wunused-function]

This removes the incorrect #ifdef and instead uses a __maybe_unused
annotation to let the compiler know it can silently drop
the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/amd/xgbe/xgbe-main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
index 3eee3201b58f..a86f32106639 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
@@ -829,8 +829,7 @@ static int xgbe_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int xgbe_suspend(struct device *dev)
+static int __maybe_unused xgbe_suspend(struct device *dev)
 {
 	struct net_device *netdev = dev_get_drvdata(dev);
 	struct xgbe_prv_data *pdata = netdev_priv(netdev);
@@ -850,7 +849,7 @@ static int xgbe_suspend(struct device *dev)
 	return ret;
 }
 
-static int xgbe_resume(struct device *dev)
+static int __maybe_unused xgbe_resume(struct device *dev)
 {
 	struct net_device *netdev = dev_get_drvdata(dev);
 	struct xgbe_prv_data *pdata = netdev_priv(netdev);
@@ -868,7 +867,6 @@ static int xgbe_resume(struct device *dev)
 
 	return ret;
 }
-#endif /* CONFIG_PM */
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id xgbe_acpi_match[] = {
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1348267 — [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions
Message-ID<r8hvD-1yT-61@gated-at.bofh.it>
In reply to#1348247
The pm2301 charger driver uses nested #ifdefs to check for both
CONFIG_PM and CONFIG_PM_SLEEP in an attempt to hide its
suspend and runtime-pm operations when they are unused, but
it does not hide the clear_lpn_pin() function in the same
way, so we get a build warning when everything is
disabled:

drivers/power/pm2301_charger.c:123:13: error: 'clear_lpn_pin' defined but not used [-Werror=unused-function]

This removes all the #ifdef and instead uses __maybe_unused
annotations to let the compiler know it can silently drop
the function definition.

For the PM2XXX_PM_OPS, we can use an IS_ENABLED() check
to avoid defining the structure when CONFIG_PM is not set without
the #ifdef.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/power/pm2301_charger.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c
index 8f9bd1d0eeb6..fb62ed3fc38c 100644
--- a/drivers/power/pm2301_charger.c
+++ b/drivers/power/pm2301_charger.c
@@ -911,11 +911,7 @@ static struct pm2xxx_irq pm2xxx_charger_irq[] = {
 	{"PM2XXX_IRQ_INT", pm2xxx_irq_int},
 };
 
-#ifdef CONFIG_PM
-
-#ifdef CONFIG_PM_SLEEP
-
-static int pm2xxx_wall_charger_resume(struct device *dev)
+static int __maybe_unused pm2xxx_wall_charger_resume(struct device *dev)
 {
 	struct i2c_client *i2c_client = to_i2c_client(dev);
 	struct pm2xxx_charger *pm2;
@@ -931,7 +927,7 @@ static int pm2xxx_wall_charger_resume(struct device *dev)
 	return 0;
 }
 
-static int pm2xxx_wall_charger_suspend(struct device *dev)
+static int __maybe_unused pm2xxx_wall_charger_suspend(struct device *dev)
 {
 	struct i2c_client *i2c_client = to_i2c_client(dev);
 	struct pm2xxx_charger *pm2;
@@ -949,9 +945,7 @@ static int pm2xxx_wall_charger_suspend(struct device *dev)
 	return 0;
 }
 
-#endif
-
-static int  pm2xxx_runtime_suspend(struct device *dev)
+static int __maybe_unused pm2xxx_runtime_suspend(struct device *dev)
 {
 	struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
 	struct pm2xxx_charger *pm2;
@@ -962,7 +956,7 @@ static int  pm2xxx_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int  pm2xxx_runtime_resume(struct device *dev)
+static int __maybe_unused pm2xxx_runtime_resume(struct device *dev)
 {
 	struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
 	struct pm2xxx_charger *pm2;
@@ -975,15 +969,11 @@ static int  pm2xxx_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops pm2xxx_pm_ops = {
+static const struct dev_pm_ops pm2xxx_pm_ops __maybe_unused = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm2xxx_wall_charger_suspend,
 		pm2xxx_wall_charger_resume)
 	SET_RUNTIME_PM_OPS(pm2xxx_runtime_suspend, pm2xxx_runtime_resume, NULL)
 };
-#define  PM2XXX_PM_OPS (&pm2xxx_pm_ops)
-#else
-#define  PM2XXX_PM_OPS  NULL
-#endif
 
 static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
 		const struct i2c_device_id *id)
@@ -1244,7 +1234,7 @@ static struct i2c_driver pm2xxx_charger_driver = {
 	.remove = pm2xxx_wall_charger_remove,
 	.driver = {
 		.name = "pm2xxx-wall_charger",
-		.pm = PM2XXX_PM_OPS,
+		.pm = IS_ENABLED(CONFIG_PM) ? &pm2xxx_pm_ops : NULL,
 	},
 	.id_table = pm2xxx_id,
 };
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1349214 — Re: [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions

FromSebastian Reichel <sre@kernel.org>
Date2016-03-03 15:30 +0100
SubjectRe: [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions
Message-ID<r8Cqn-8hu-27@gated-at.bofh.it>
In reply to#1348267

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Wed, Mar 02, 2016 at 04:58:56PM +0100, Arnd Bergmann wrote:
> The pm2301 charger driver uses nested #ifdefs to check for both
> CONFIG_PM and CONFIG_PM_SLEEP in an attempt to hide its
> suspend and runtime-pm operations when they are unused, but
> it does not hide the clear_lpn_pin() function in the same
> way, so we get a build warning when everything is
> disabled:
> 
> drivers/power/pm2301_charger.c:123:13: error: 'clear_lpn_pin' defined but not used [-Werror=unused-function]
> 
> This removes all the #ifdef and instead uses __maybe_unused
> annotations to let the compiler know it can silently drop
> the function definition.
> 
> For the PM2XXX_PM_OPS, we can use an IS_ENABLED() check
> to avoid defining the structure when CONFIG_PM is not set without
> the #ifdef.

Thanks, queued.

-- Sebastian

[toc] | [prev] | [next] | [standalone]


#1348269 — [PATCH 14/14] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 17:10 +0100
Subject[PATCH 14/14] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume
Message-ID<r8hvD-1yT-67@gated-at.bofh.it>
In reply to#1348247
The rockchip spdif driver uses SIMPLE_DEV_PM_OPS to conditionally
set its power management functions, but we get a warning
about rk_spdif_runtime_resume being unused when CONFIG_PM is not
set:

sound/soc/rockchip/rockchip_spdif.c:67:12: error: 'rk_spdif_runtime_resume' defined but not used [-Werror=unused-function]

This adds a __maybe_unused annotation so the compiler knows
it can silently drop it instead of warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/rockchip/rockchip_spdif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index 5a806da89f42..274599d4caeb 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -54,7 +54,7 @@ static const struct of_device_id rk_spdif_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rk_spdif_match);
 
-static int rk_spdif_runtime_suspend(struct device *dev)
+static int __maybe_unused rk_spdif_runtime_suspend(struct device *dev)
 {
 	struct rk_spdif_dev *spdif = dev_get_drvdata(dev);
 
@@ -64,7 +64,7 @@ static int rk_spdif_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int rk_spdif_runtime_resume(struct device *dev)
+static int __maybe_unused rk_spdif_runtime_resume(struct device *dev)
 {
 	struct rk_spdif_dev *spdif = dev_get_drvdata(dev);
 	int ret;
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web