[alsa-devel] [PATCH 00/14] drivers: use __maybe_unused to hide pm functions
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(-)
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;
The patch
ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From d8fc2198aab117a4bc16ee305caef19c4c7e7f5c Mon Sep 17 00:00:00 2001
From: Arnd Bergmann arnd@arndb.de Date: Wed, 2 Mar 2016 16:59:06 +0100 Subject: [PATCH] ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume
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 Signed-off-by: Mark Brown broonie@kernel.org --- 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;
participants (2)
-
Arnd Bergmann
-
Mark Brown