mmc: sunxi: mark PM functions as __maybe_unused
Subsystems (2)
PATCH 1/1 mmc: sunxi: mark PM functions as __maybe_unused
The newly added runtime-pm functions cause a harmless warning when CONFIG_PM is disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static int sunxi_mmc_runtime_suspend(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static int sunxi_mmc_runtime_resume(struct device *dev)
This marks them as __maybe_unused to shut up the warning.
--- drivers/mmc/host/sunxi-mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sunxi-mmc.c +2 -2
@@ -1432,7 +1432,7 @@ static int sunxi_mmc_remove(struct platform_device *pdev)return 0 ; } -static int sunxi_mmc_runtime_resume (struct device *dev) +static int __maybe_unused sunxi_mmc_runtime_resume (struct device *dev) {struct mmc_host *mmc =dev_get_drvdata (dev);struct sunxi_mmc_host *host =mmc_priv (mmc);
@@ -1449,7 +1449,7 @@ static int sunxi_mmc_runtime_resume(struct device *dev)return 0 ; } -static int sunxi_mmc_runtime_suspend (struct device *dev) +static int __maybe_unused sunxi_mmc_runtime_suspend (struct device *dev) {struct mmc_host *mmc =dev_get_drvdata (dev);struct sunxi_mmc_host *host =mmc_priv (mmc);
Signature · 1 line
2.9.0
Quoted 5 lines · Arnd Bergmann
The newly added runtime-pm functions cause a harmless warning when
CONFIG_PMis disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_suspend(struct device *dev)
Quoted 8 lines
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_resume(struct device *dev)This marks them as
__maybe_unusedto shut up the warning.Fixes 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support")Signed-off-by Arnd Bergmann <[email protected]>
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180528/7e148807/attachment.sig>
Quoted 10 lines · Arnd Bergmann
The newly added runtime-pm functions cause a harmless warning when
CONFIG_PMis disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_suspend(struct device *dev)^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_resume(struct device *dev)This marks them as
__maybe_unusedto shut up the warning.
Most mmc drivers uses #ifdef CONFIG_PM instead of the __maybe_unused() option.
It's not a big deal, but consistency is always good. Would you mind changing?
Br
Uffe
Quoted 32 lines
Fixes 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/mmc/host/sunxi-mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mmc/host/sunxi-mmc.c +2
-3@@ -1432,7 +1432,7 @@ static int sunxi_mmc_remove(struct platform_device *pdev)return 0 ; } -static int sunxi_mmc_runtime_resume (struct device *dev) +static int __maybe_unused sunxi_mmc_runtime_resume (struct device *dev) {struct mmc_host *mmc =dev_get_drvdata (dev);struct sunxi_mmc_host *host =mmc_priv (mmc);@@ -1449,7 +1449,7 @@ static int sunxi_mmc_runtime_resume(struct device *dev)return 0 ; } -static int sunxi_mmc_runtime_suspend (struct device *dev) +static int __maybe_unused sunxi_mmc_runtime_suspend (struct device *dev) {struct mmc_host *mmc =dev_get_drvdata (dev);struct sunxi_mmc_host *host =mmc_priv (mmc); --2.9.0
Quoted 10 lines · Ulf Hansson
Quoted 9 lines · Arnd Bergmann
The newly added runtime-pm functions cause a harmless warning when
CONFIG_PMis disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_suspend(struct device *dev)^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_resume(struct device *dev)
Quoted 5 lines
Quoted 1 line
This marks them as
__maybe_unusedto shut up the warning.Most mmc drivers uses #ifdef
CONFIG_PMinstead of the__maybe_unused()option.It's not a big deal, but consistency is always good. Would you mind changing?
I'd prefer not to. Most uses of #ifdef CONFIG_PM that get introduced are wrong, and cause additional randconfig warnings that I end up having to fix, so I always
do it with __maybe_unused.
I don't mind if you treat my patch as a bug report and decide to fix it differently
yourself, but you won't get that patch from me ;-)
Arnd
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · Ulf Hansson
Quoted 10 lines · Arnd Bergmann
The newly added runtime-pm functions cause a harmless warning when
CONFIG_PMis disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_suspend(struct device *dev)^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_resume(struct device *dev)This marks them as
__maybe_unusedto shut up the warning.
Quoted 8 lines
Quoted 3 lines
Most mmc drivers uses #ifdef
CONFIG_PMinstead of the__maybe_unused()option.It's not a big deal, but consistency is always good. Would you mind changing?
I'd prefer not to. Most uses of #ifdef
CONFIG_PMthat get introduced are wrong, and cause additional randconfig warnings that I end up having to fix, so I always
do it with__maybe_unused.
Right.
Quoted 4 lines
I don't mind if you treat my patch as a bug report and decide to fix it differently
yourself, but you won't get that patch from me ;-)
No, worries then. As stated, it's not a big deal.
Applied for next!
Kind regads
Uffe
+Cc: Jean
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · Ulf Hansson
Quoted 10 lines · Arnd Bergmann
The newly added runtime-pm functions cause a harmless warning when
CONFIG_PMis disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_suspend(struct device *dev)^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_resume(struct device *dev)This marks them as
__maybe_unusedto shut up the warning.
Quoted 8 lines
Quoted 3 lines
Most mmc drivers uses #ifdef
CONFIG_PMinstead of the__maybe_unused()option.It's not a big deal, but consistency is always good. Would you mind changing?
I'd prefer not to. Most uses of #ifdef
CONFIG_PMthat get introduced are wrong, and cause additional randconfig warnings that I end up having to fix, so I always
do it with__maybe_unused.
Some of the maintainers have strong objection against such changes.
http://lkml.iu.edu/hypermail/linux/kernel/1805.1/06100.html
It seems we might have a split in the opinions, which is not good in this case (consistency for PM callbacks overall will be broken).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 25 lines · Andy Shevchenko
+Cc: Jean
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · Ulf Hansson
Quoted 10 lines · Arnd Bergmann
The newly added runtime-pm functions cause a harmless warning when
CONFIG_PMis disabled:
drivers/mmc/host/sunxi-mmc.c:1452:12: error: 'sunxi_mmc_runtime_suspend' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_suspend(struct device *dev)^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/sunxi-mmc.c:1435:12: error: 'sunxi_mmc_runtime_resume' defined but not used [-Werror=unused-function]
static intsunxi_mmc_runtime_resume(struct device *dev)This marks them as
__maybe_unusedto shut up the warning.Quoted 8 lines
Quoted 3 lines
Most mmc drivers uses #ifdef
CONFIG_PMinstead of the__maybe_unused()option.It's not a big deal, but consistency is always good. Would you mind changing?
I'd prefer not to. Most uses of #ifdef
CONFIG_PMthat get introduced are wrong, and cause additional randconfig warnings that I end up having to fix, so I always
do it with__maybe_unused.
Quoted 5 lines
Some of the maintainers have strong objection against such changes.
http://lkml.iu.edu/hypermail/linux/kernel/1805.1/06100.htmlIt seems we might have a split in the opinions, which is not good in this case (consistency for PM callbacks overall will be broken).
We actually talked about this at the kernel summit last year, and the conclusion was that we should replace the SET_RUNTIME_PM_OPS(), SIMPLE_DEV_PM_OPS(), SET_SYSTEM_SLEEP_PM_OPS()
etc macros with new ones that don't require the ugly #ifdef and just silently drop the unused functions.
Unfortunately we can't extend the existing macros to work that way (it breaks for drivers that have an #ifdef today), and nobody could come up with a new name that is at least as readable as the current one.
Note that incorrect #ifdef usage here is the most common source of newly introduced build warnings and errors in the kernel, everyone gets those wrong since they are just very confusing.
Arnd