linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: i801: mark PM functions as __maybe_unused
@ 2018-05-08  7:38 Anders Roxell
  2018-05-09 17:00 ` Jean Delvare
  0 siblings, 1 reply; 10+ messages in thread
From: Anders Roxell @ 2018-05-08  7:38 UTC (permalink / raw)
  To: jdelvare; +Cc: linux-i2c, linux-kernel, Anders Roxell

With CONFIG_PM, we get a harmless build warning:
drivers/i2c/busses/i2c-i801.c:1723:12: warning: ‘i801_resume’ defined but not used [-Wunused-function]
 static int i801_resume(struct device *dev)
            ^~~~~~~~~~~
drivers/i2c/busses/i2c-i801.c:1714:12: warning: ‘i801_suspend’ defined but not used [-Wunused-function]
 static int i801_suspend(struct device *dev)
            ^~~~~~~~~~~~

This marks the affected functions as __maybe_unused.

Fixes: a9c8088c7988 ("i2c: i801: Don't restore config registers on runtime PM")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/i2c/busses/i2c-i801.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index ed07f9002710..ff18c6ed2bec 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1711,7 +1711,7 @@ static void i801_shutdown(struct pci_dev *dev)
 }
 
 #ifdef CONFIG_PM
-static int i801_suspend(struct device *dev)
+static int __maybe_unused i801_suspend(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct i801_priv *priv = pci_get_drvdata(pci_dev);
@@ -1720,7 +1720,7 @@ static int i801_suspend(struct device *dev)
 	return 0;
 }
 
-static int i801_resume(struct device *dev)
+static int __maybe_unused i801_resume(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct i801_priv *priv = pci_get_drvdata(pci_dev);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] i2c: i801: mark PM functions as __maybe_unused
@ 2018-05-25 21:09 Arnd Bergmann
  2018-05-25 21:57 ` Wolfram Sang
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2018-05-25 21:09 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Arnd Bergmann, Wolfram Sang, Jarkko Nikula, Hans de Goede,
	Srinivas Pandruvada, Qiuxu Zhuo, linux-i2c, linux-kernel

Changing from UNIVERSAL_DEV_PM_OPS to SIMPLE_DEV_PM_OPS caused a harmless
warning in configurations without CONFIG_PM_SLEEP:

drivers/i2c/busses/i2c-i801.c:1723:12: error: 'i801_resume' defined but not used [-Werror=unused-function]
 static int i801_resume(struct device *dev)
            ^~~~~~~~~~~
drivers/i2c/busses/i2c-i801.c:1714:12: error: 'i801_suspend' defined but not used [-Werror=unused-function]
 static int i801_suspend(struct device *dev)

This removes the incorrect #ifdef and instead marks both functions as
__maybe_unused, which is a more robust way to express the same thing.

Fixes: a9c8088c7988 ("i2c: i801: Don't restore config registers on runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/i2c/busses/i2c-i801.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index ed07f9002710..d6d46e7a5376 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1710,8 +1710,7 @@ static void i801_shutdown(struct pci_dev *dev)
 	pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg);
 }
 
-#ifdef CONFIG_PM
-static int i801_suspend(struct device *dev)
+static int __maybe_unused i801_suspend(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct i801_priv *priv = pci_get_drvdata(pci_dev);
@@ -1720,7 +1719,7 @@ static int i801_suspend(struct device *dev)
 	return 0;
 }
 
-static int i801_resume(struct device *dev)
+static int __maybe_unused i801_resume(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct i801_priv *priv = pci_get_drvdata(pci_dev);
@@ -1729,7 +1728,6 @@ static int i801_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(i801_pm_ops, i801_suspend, i801_resume);
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-05-25 21:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08  7:38 [PATCH] i2c: i801: mark PM functions as __maybe_unused Anders Roxell
2018-05-09 17:00 ` Jean Delvare
2018-05-10 13:27   ` Jean Delvare
2018-05-14  9:33     ` [PATCH v2] i2c: i801: fix unused-function warning Anders Roxell
2018-05-14 15:02       ` Jean Delvare
2018-05-14 17:18       ` Andy Shevchenko
2018-05-15  8:16         ` Jean Delvare
2018-05-17 13:54       ` Wolfram Sang
2018-05-25 21:09 [PATCH] i2c: i801: mark PM functions as __maybe_unused Arnd Bergmann
2018-05-25 21:57 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).