* [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-02 16:06 ` Nicolas Ferre
` (2 more replies)
2016-03-02 15:58 ` [PATCH 02/14] irqchip: st: use __maybe_unused to hide st_irq_syscfg_resume Arnd Bergmann
` (12 subsequent siblings)
13 siblings, 3 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 01/14] pinctrl: at91: " Arnd Bergmann
@ 2016-03-02 16:06 ` Nicolas Ferre
2016-03-02 16:47 ` Ludovic Desroches
2016-03-09 4:09 ` Linus Walleij
2 siblings, 0 replies; 32+ messages in thread
From: Nicolas Ferre @ 2016-03-02 16:06 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 01/14] pinctrl: at91: " Arnd Bergmann
2016-03-02 16:06 ` Nicolas Ferre
@ 2016-03-02 16:47 ` Ludovic Desroches
2016-03-09 4:09 ` Linus Walleij
2 siblings, 0 replies; 32+ messages in thread
From: Ludovic Desroches @ 2016-03-02 16:47 UTC (permalink / raw)
To: linux-arm-kernel
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
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 01/14] pinctrl: at91: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 01/14] pinctrl: at91: " Arnd Bergmann
2016-03-02 16:06 ` Nicolas Ferre
2016-03-02 16:47 ` Ludovic Desroches
@ 2016-03-09 4:09 ` Linus Walleij
2 siblings, 0 replies; 32+ messages in thread
From: Linus Walleij @ 2016-03-09 4:09 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 2, 2016 at 10:58 PM, Arnd Bergmann <arnd@arndb.de> 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>
Patch applied with the maintainer ACKs.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 02/14] irqchip: st: use __maybe_unused to hide st_irq_syscfg_resume
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
2016-03-02 15:58 ` [PATCH 01/14] pinctrl: at91: " Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-02 15:58 ` [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions Arnd Bergmann
` (11 subsequent siblings)
13 siblings, 0 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
the st irqchip driver uses SIMPLE_DEV_PM_OPS to conditionally
set its power management functions, but we get a warning
about st_irq_syscfg_resume being unused when CONFIG_PM is not
set:
drivers/irqchip/irq-st.c:183:12: error: 'st_irq_syscfg_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>
---
drivers/irqchip/irq-st.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-st.c b/drivers/irqchip/irq-st.c
index 9af48a85c16f..5e0e250db0be 100644
--- a/drivers/irqchip/irq-st.c
+++ b/drivers/irqchip/irq-st.c
@@ -180,7 +180,7 @@ static int st_irq_syscfg_probe(struct platform_device *pdev)
return st_irq_syscfg_enable(pdev);
}
-static int st_irq_syscfg_resume(struct device *dev)
+static int __maybe_unused st_irq_syscfg_resume(struct device *dev)
{
struct st_irq_syscfg *ddata = dev_get_drvdata(dev);
--
2.7.0
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
2016-03-02 15:58 ` [PATCH 01/14] pinctrl: at91: " Arnd Bergmann
2016-03-02 15:58 ` [PATCH 02/14] irqchip: st: use __maybe_unused to hide st_irq_syscfg_resume Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-03 14:23 ` Sebastian Reichel
2016-03-02 15:58 ` [PATCH 04/14] power: pm2301-charger: " Arnd Bergmann
` (10 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (2 preceding siblings ...)
2016-03-02 15:58 ` [PATCH 03/14] power: ipaq-micro-battery: use __maybe_unused to hide pm functions Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-03 14:23 ` Sebastian Reichel
2016-03-02 15:58 ` [PATCH 05/14] mfd: ipaq-micro: " Arnd Bergmann
` (9 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 04/14] power: pm2301-charger: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 04/14] power: pm2301-charger: " Arnd Bergmann
@ 2016-03-03 14:23 ` Sebastian Reichel
0 siblings, 0 replies; 32+ messages in thread
From: Sebastian Reichel @ 2016-03-03 14:23 UTC (permalink / raw)
To: linux-arm-kernel
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160303/2fc7c7a5/attachment.sig>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 05/14] mfd: ipaq-micro: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (3 preceding siblings ...)
2016-03-02 15:58 ` [PATCH 04/14] power: pm2301-charger: " Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-08 4:27 ` Lee Jones
2016-03-02 15:58 ` [PATCH 06/14] dma: sirf: " Arnd Bergmann
` (8 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
The ipaq-micro driver uses SET_SYSTEM_SLEEP_PM_OPS() to
remove the reference to its resume function, but does
not use an #ifdef around the definition, so we get
a build warning:
drivers/mfd/ipaq-micro.c:379:12: error: 'micro_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>
---
drivers/mfd/ipaq-micro.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
index a41859c55bda..df16fd1df68b 100644
--- a/drivers/mfd/ipaq-micro.c
+++ b/drivers/mfd/ipaq-micro.c
@@ -376,7 +376,7 @@ static const struct mfd_cell micro_cells[] = {
{ .name = "ipaq-micro-leds", },
};
-static int micro_resume(struct device *dev)
+static int __maybe_unused micro_resume(struct device *dev)
{
struct ipaq_micro *micro = dev_get_drvdata(dev);
--
2.7.0
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 05/14] mfd: ipaq-micro: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 05/14] mfd: ipaq-micro: " Arnd Bergmann
@ 2016-03-08 4:27 ` Lee Jones
0 siblings, 0 replies; 32+ messages in thread
From: Lee Jones @ 2016-03-08 4:27 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 02 Mar 2016, Arnd Bergmann wrote:
> The ipaq-micro driver uses SET_SYSTEM_SLEEP_PM_OPS() to
> remove the reference to its resume function, but does
> not use an #ifdef around the definition, so we get
> a build warning:
>
> drivers/mfd/ipaq-micro.c:379:12: error: 'micro_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>
> ---
> drivers/mfd/ipaq-micro.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
> diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
> index a41859c55bda..df16fd1df68b 100644
> --- a/drivers/mfd/ipaq-micro.c
> +++ b/drivers/mfd/ipaq-micro.c
> @@ -376,7 +376,7 @@ static const struct mfd_cell micro_cells[] = {
> { .name = "ipaq-micro-leds", },
> };
>
> -static int micro_resume(struct device *dev)
> +static int __maybe_unused micro_resume(struct device *dev)
> {
> struct ipaq_micro *micro = dev_get_drvdata(dev);
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (4 preceding siblings ...)
2016-03-02 15:58 ` [PATCH 05/14] mfd: ipaq-micro: " Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-03 3:47 ` Vinod Koul
2016-03-02 15:58 ` [PATCH 07/14] hw_random: exynos: " Arnd Bergmann
` (7 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 06/14] dma: sirf: " Arnd Bergmann
@ 2016-03-03 3:47 ` Vinod Koul
2016-03-03 12:33 ` Arnd Bergmann
0 siblings, 1 reply; 32+ messages in thread
From: Vinod Koul @ 2016-03-03 3:47 UTC (permalink / raw)
To: linux-arm-kernel
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
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
2016-03-03 3:47 ` Vinod Koul
@ 2016-03-03 12:33 ` Arnd Bergmann
2016-03-04 15:02 ` Vinod Koul
0 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-03 12:33 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions
2016-03-03 12:33 ` Arnd Bergmann
@ 2016-03-04 15:02 ` Vinod Koul
0 siblings, 0 replies; 32+ messages in thread
From: Vinod Koul @ 2016-03-04 15:02 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Mar 03, 2016 at 01:33:17PM +0100, Arnd Bergmann wrote:
> 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.
Thanks, applied now after fixing subsystem name
--
~Vinod
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 07/14] hw_random: exynos: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (5 preceding siblings ...)
2016-03-02 15:58 ` [PATCH 06/14] dma: sirf: " Arnd Bergmann
@ 2016-03-02 15:58 ` Arnd Bergmann
2016-03-02 23:43 ` Krzysztof Kozlowski
2016-03-11 13:31 ` Herbert Xu
2016-03-02 15:59 ` [PATCH 08/14] scsi: mvumi: " Arnd Bergmann
` (6 subsequent siblings)
13 siblings, 2 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:58 UTC (permalink / raw)
To: linux-arm-kernel
The exynos random driver 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/char/hw_random/exynos-rng.c:166:12: error: 'exynos_rng_suspend' defined but not used [-Werror=unused-function]
drivers/char/hw_random/exynos-rng.c:171:12: error: 'exynos_rng_resume' 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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/char/hw_random/exynos-rng.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c
index 30cf4623184f..ada081232528 100644
--- a/drivers/char/hw_random/exynos-rng.c
+++ b/drivers/char/hw_random/exynos-rng.c
@@ -144,8 +144,7 @@ static int exynos_rng_probe(struct platform_device *pdev)
return devm_hwrng_register(&pdev->dev, &exynos_rng->rng);
}
-#ifdef CONFIG_PM
-static int exynos_rng_runtime_suspend(struct device *dev)
+static int __maybe_unused exynos_rng_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
@@ -155,7 +154,7 @@ static int exynos_rng_runtime_suspend(struct device *dev)
return 0;
}
-static int exynos_rng_runtime_resume(struct device *dev)
+static int __maybe_unused exynos_rng_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
@@ -163,12 +162,12 @@ static int exynos_rng_runtime_resume(struct device *dev)
return clk_prepare_enable(exynos_rng->clk);
}
-static int exynos_rng_suspend(struct device *dev)
+static int __maybe_unused exynos_rng_suspend(struct device *dev)
{
return pm_runtime_force_suspend(dev);
}
-static int exynos_rng_resume(struct device *dev)
+static int __maybe_unused exynos_rng_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
@@ -180,7 +179,6 @@ static int exynos_rng_resume(struct device *dev)
return exynos_rng_configure(exynos_rng);
}
-#endif
static const struct dev_pm_ops exynos_rng_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(exynos_rng_suspend, exynos_rng_resume)
--
2.7.0
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 07/14] hw_random: exynos: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 07/14] hw_random: exynos: " Arnd Bergmann
@ 2016-03-02 23:43 ` Krzysztof Kozlowski
2016-03-11 13:31 ` Herbert Xu
1 sibling, 0 replies; 32+ messages in thread
From: Krzysztof Kozlowski @ 2016-03-02 23:43 UTC (permalink / raw)
To: linux-arm-kernel
On 03.03.2016 00:58, Arnd Bergmann wrote:
> The exynos random driver 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/char/hw_random/exynos-rng.c:166:12: error: 'exynos_rng_suspend' defined but not used [-Werror=unused-function]
> drivers/char/hw_random/exynos-rng.c:171:12: error: 'exynos_rng_resume' 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.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/char/hw_random/exynos-rng.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 07/14] hw_random: exynos: use __maybe_unused to hide pm functions
2016-03-02 15:58 ` [PATCH 07/14] hw_random: exynos: " Arnd Bergmann
2016-03-02 23:43 ` Krzysztof Kozlowski
@ 2016-03-11 13:31 ` Herbert Xu
1 sibling, 0 replies; 32+ messages in thread
From: Herbert Xu @ 2016-03-11 13:31 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 02, 2016 at 04:58:59PM +0100, Arnd Bergmann wrote:
> The exynos random driver 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/char/hw_random/exynos-rng.c:166:12: error: 'exynos_rng_suspend' defined but not used [-Werror=unused-function]
> drivers/char/hw_random/exynos-rng.c:171:12: error: 'exynos_rng_resume' 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.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 08/14] scsi: mvumi: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (6 preceding siblings ...)
2016-03-02 15:58 ` [PATCH 07/14] hw_random: exynos: " Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
2016-03-03 8:30 ` Johannes Thumshirn
2016-03-05 22:08 ` Martin K. Petersen
2016-03-02 15:59 ` [PATCH 09/14] amd-xgbe: " Arnd Bergmann
` (5 subsequent siblings)
13 siblings, 2 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
The mvumi scsi hides the references to its suspend/resume functions
in an #ifdef but does not hide the implementation the same way:
drivers/scsi/mvumi.c:2632:12: error: 'mvumi_suspend' defined but not used [-Werror=unused-function]
drivers/scsi/mvumi.c:2651:12: error: 'mvumi_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, while avoiding
the addition of another #ifdef.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/mvumi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 02360de6b7e0..39285070f3b5 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -2629,7 +2629,7 @@ static void mvumi_shutdown(struct pci_dev *pdev)
mvumi_flush_cache(mhba);
}
-static int mvumi_suspend(struct pci_dev *pdev, pm_message_t state)
+static int __maybe_unused mvumi_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct mvumi_hba *mhba = NULL;
@@ -2648,7 +2648,7 @@ static int mvumi_suspend(struct pci_dev *pdev, pm_message_t state)
return 0;
}
-static int mvumi_resume(struct pci_dev *pdev)
+static int __maybe_unused mvumi_resume(struct pci_dev *pdev)
{
int ret;
struct mvumi_hba *mhba = NULL;
--
2.7.0
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 08/14] scsi: mvumi: use __maybe_unused to hide pm functions
2016-03-02 15:59 ` [PATCH 08/14] scsi: mvumi: " Arnd Bergmann
@ 2016-03-03 8:30 ` Johannes Thumshirn
2016-03-05 22:08 ` Martin K. Petersen
1 sibling, 0 replies; 32+ messages in thread
From: Johannes Thumshirn @ 2016-03-03 8:30 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 02, 2016 at 04:59:00PM +0100, Arnd Bergmann wrote:
> The mvumi scsi hides the references to its suspend/resume functions
> in an #ifdef but does not hide the implementation the same way:
>
> drivers/scsi/mvumi.c:2632:12: error: 'mvumi_suspend' defined but not used [-Werror=unused-function]
> drivers/scsi/mvumi.c:2651:12: error: 'mvumi_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, while avoiding
> the addition of another #ifdef.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn at suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 08/14] scsi: mvumi: use __maybe_unused to hide pm functions
2016-03-02 15:59 ` [PATCH 08/14] scsi: mvumi: " Arnd Bergmann
2016-03-03 8:30 ` Johannes Thumshirn
@ 2016-03-05 22:08 ` Martin K. Petersen
1 sibling, 0 replies; 32+ messages in thread
From: Martin K. Petersen @ 2016-03-05 22:08 UTC (permalink / raw)
To: linux-arm-kernel
>>>>> "Arnd" == Arnd Bergmann <arnd@arndb.de> writes:
Arnd> The mvumi scsi hides the references to its suspend/resume
Arnd> functions in an #ifdef but does not hide the implementation the
Arnd> same way:
Applied to 4.6/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 09/14] amd-xgbe: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (7 preceding siblings ...)
2016-03-02 15:59 ` [PATCH 08/14] scsi: mvumi: " Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
2016-03-02 15:59 ` [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_ Arnd Bergmann
` (4 subsequent siblings)
13 siblings, 0 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (8 preceding siblings ...)
2016-03-02 15:59 ` [PATCH 09/14] amd-xgbe: " Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
2016-03-08 10:33 ` [10/14] " Kalle Valo
2016-03-02 15:59 ` [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions Arnd Bergmann
` (3 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [10/14] wireless: cw1200: use __maybe_unused to hide pm functions_
2016-03-02 15:59 ` [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_ Arnd Bergmann
@ 2016-03-08 10:33 ` Kalle Valo
0 siblings, 0 replies; 32+ messages in thread
From: Kalle Valo @ 2016-03-08 10:33 UTC (permalink / raw)
To: linux-arm-kernel
> 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>
Thanks, applied to wireless-drivers-next.git.
Kalle Valo
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (9 preceding siblings ...)
2016-03-02 15:59 ` [PATCH 10/14] wireless: cw1200: use __maybe_unused to hide pm functions_ Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
2016-03-02 17:12 ` Dmitry Torokhov
2016-03-02 15:59 ` [PATCH 12/14] keyboard: snvs-pwrkey: " Arnd Bergmann
` (2 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions
2016-03-02 15:59 ` [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions Arnd Bergmann
@ 2016-03-02 17:12 ` Dmitry Torokhov
0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Torokhov @ 2016-03-02 17:12 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (10 preceding siblings ...)
2016-03-02 15:59 ` [PATCH 11/14] input: spear-keyboard: use __maybe_unused to hide pm functions Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
2016-03-02 16:04 ` Frank Li
2016-03-02 15:59 ` [PATCH 13/14] [media] omap3isp: use IS_ENABLED() " Arnd Bergmann
2016-03-02 15:59 ` [PATCH 14/14] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume Arnd Bergmann
13 siblings, 1 reply; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
2016-03-02 15:59 ` [PATCH 12/14] keyboard: snvs-pwrkey: " Arnd Bergmann
@ 2016-03-02 16:04 ` Frank Li
2016-03-02 17:12 ` Dmitry Torokhov
0 siblings, 1 reply; 32+ messages in thread
From: Frank Li @ 2016-03-02 16:04 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd at arndb.de]
> Sent: Wednesday, March 02, 2016 9:59 AM
> To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-arm-kernel at lists.infradead.org; Arnd Bergmann <arnd@arndb.de>;
> Shawn Guo <shawnguo@kernel.org>; b38343 at freescale.com; Javier
> Martinez Canillas <javier@osg.samsung.com>; Frank Li
> <Frank.Li@freescale.com>; linux-input at vger.kernel.org; linux-
> kernel at 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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 12/14] keyboard: snvs-pwrkey: use __maybe_unused to hide pm functions
2016-03-02 16:04 ` Frank Li
@ 2016-03-02 17:12 ` Dmitry Torokhov
0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Torokhov @ 2016-03-02 17:12 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 02, 2016 at 04:04:46PM +0000, Frank Li wrote:
>
>
> > -----Original Message-----
> > From: Arnd Bergmann [mailto:arnd at arndb.de]
> > Sent: Wednesday, March 02, 2016 9:59 AM
> > To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: linux-arm-kernel at lists.infradead.org; Arnd Bergmann <arnd@arndb.de>;
> > Shawn Guo <shawnguo@kernel.org>; b38343 at freescale.com; Javier
> > Martinez Canillas <javier@osg.samsung.com>; Frank Li
> > <Frank.Li@freescale.com>; linux-input at vger.kernel.org; linux-
> > kernel at 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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 13/14] [media] omap3isp: use IS_ENABLED() to hide pm functions
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (11 preceding siblings ...)
2016-03-02 15:59 ` [PATCH 12/14] keyboard: snvs-pwrkey: " Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
2016-03-02 15:59 ` [PATCH 14/14] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume Arnd Bergmann
13 siblings, 0 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 14/14] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume
2016-03-02 15:58 [PATCH 00/14] drivers: use __maybe_unused to hide pm functions Arnd Bergmann
` (12 preceding siblings ...)
2016-03-02 15:59 ` [PATCH 13/14] [media] omap3isp: use IS_ENABLED() " Arnd Bergmann
@ 2016-03-02 15:59 ` Arnd Bergmann
13 siblings, 0 replies; 32+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:59 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 32+ messages in thread