diff mbox series

i2c: i801: mark PM functions as __maybe_unused

Message ID 20180525210952.1861881-1-arnd@arndb.de
State Not Applicable
Headers show
Series i2c: i801: mark PM functions as __maybe_unused | expand

Commit Message

Arnd Bergmann May 25, 2018, 9:09 p.m. UTC
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(-)

Comments

Wolfram Sang May 25, 2018, 9:57 p.m. UTC | #1
On Fri, May 25, 2018 at 11:09:46PM +0200, Arnd Bergmann wrote:
> 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>

Should be fixed in my for-next branch:

https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/commit/drivers/i2c/busses/i2c-i801.c?h=i2c/for-next&id=4b2f9bd5e39fb47011074c9a26b64b616acc18f0
diff mbox series

Patch

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