Skip to contentSkip to conversation

mmc: sunxi: mark PM functions as __maybe_unused

PATCH In review Arnd Bergmann 4 participants 7 messages May 25, 2018 – May 28, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

Fixes 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support")
---
 drivers/mmc/host/sunxi-mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sunxi-mmc.c +2 -2
index 97c6b79b7d6f..837888b96bd3 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

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)

Quoted 8 lines
            ^~~~~~~~~~~~~~~~~~~~~~~~~

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.

Fixes 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support")

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>
#2 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

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.

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")
---
 drivers/mmc/host/sunxi-mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sunxi-mmc.c +2 -3
index 97c6b79b7d6f..837888b96bd3 100644
@@ -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

#3 lore raw
Quoted 10 lines · Ulf Hansson
Quoted 9 lines · Arnd Bergmann

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)

Quoted 5 lines
Quoted 1 line

This marks them as __maybe_unused to 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?

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

#4 lore raw
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_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.

Quoted 8 lines
Quoted 3 lines

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?

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.

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

#5 lore raw
In reply to Arnd Bergmann

+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_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.

Quoted 8 lines
Quoted 3 lines

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?

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.

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
#6 lore raw
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_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.

Quoted 8 lines
Quoted 3 lines

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?

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.

Quoted 5 lines

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).

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