Skip to contentSkip to conversation

usb: renesas_usbhs: mark PM functions as __maybe_unused

PATCH In review Arnd Bergmann 2 participants 2 messages Dec 11, 2018 – Dec 12, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: renesas_usbhs: mark PM functions as __maybe_unused

Without CONFIG_PM, we get a new build warning here:

drivers/usb/renesas_usbhs/common.c:860:12: error: 'usbhsc_resume' defined but not used [-Werror=unused-function]
static int usbhsc_resume(struct device *dev)

            ^~~~~~~~~~~~~
drivers/usb/renesas_usbhs/common.c:844:12: error: 'usbhsc_suspend' defined but not used [-Werror=unused-function]
 static int usbhsc_suspend(struct device *dev)
            ^~~~~~~~~~~~~~

No idea why this never happened before, but it's trivial to work around by marking the functions as __maybe_unused so the compiler can silently discard them.

---
 drivers/usb/renesas_usbhs/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/common.c +2 -2
index 02c1d2bf4f86..2ff7991f4517 100644
@@ -841,7 +841,7 @@ static int usbhs_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int usbhsc_suspend(struct device *dev)
+static __maybe_unused int usbhsc_suspend(struct device *dev)
 {
 	struct usbhs_priv *priv = dev_get_drvdata(dev);
 	struct usbhs_mod *mod = usbhs_mod_get_current(priv);
@@ -857,7 +857,7 @@ static int usbhsc_suspend(struct device *dev)
 	return 0;
 }
 
-static int usbhsc_resume(struct device *dev)
+static __maybe_unused int usbhsc_resume(struct device *dev)
 {
 	struct usbhs_priv *priv = dev_get_drvdata(dev);
 	struct platform_device *pdev = usbhs_priv_to_pdev(priv);
Reviewed-by on v1 1/1
#1 lore raw

Hi Arnd,

Thank you for the patch!

Quoted 11 lines

From: Arnd Bergmann, Sent: Tuesday, December 11, 2018 7:06 PM
To: Greg Kroah-Hartman <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Yoshihiro Shimoda <[email protected]>; Felipe Balbi <[email protected]>; Simon Horman <[email protected]>; Chris Brandt <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] usb: renesas_usbhs: mark PM functions as __maybe_unused

Without CONFIG_PM, we get a new build warning here:

drivers/usb/renesas_usbhs/common.c:860:12: error: 'usbhsc_resume' defined but not used [-Werror=unused-function]
static int usbhsc_resume(struct device *dev)

Quoted 8 lines
            ^~~~~~~~~~~~~
drivers/usb/renesas_usbhs/common.c:844:12: error: 'usbhsc_suspend' defined but not used [-Werror=unused-function]
 static int usbhsc_suspend(struct device *dev)
            ^~~~~~~~~~~~~~

No idea why this never happened before, but it's trivial to work around by marking the functions as __maybe_unused so the compiler can silently discard them.

This build warning cause the commit d54d334e75b9 ("usb: renesas_usbhs:
Use SIMPLE_DEV_PM_OPS macro").

So, I'd like to add the following tag on this commit log.

Fixes d54d334e75b9 ("usb: renesas_usbhs: Use SIMPLE_DEV_PM_OPS macro")

Also, we can remove "No idea why this never happened before, but" from the commit log.

Quoted 1 line

After revised the commit log a little:

Best regards,
Yoshihiro Shimoda

Quoted 28 lines
---
 drivers/usb/renesas_usbhs/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/common.c +2 -3
index 02c1d2bf4f86..2ff7991f4517 100644
@@ -841,7 +841,7 @@ static int usbhs_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int usbhsc_suspend(struct device *dev)
+static __maybe_unused int usbhsc_suspend(struct device *dev)
 {
 	struct usbhs_priv *priv = dev_get_drvdata(dev);
 	struct usbhs_mod *mod = usbhs_mod_get_current(priv);
@@ -857,7 +857,7 @@ static int usbhsc_suspend(struct device *dev)
 	return 0;
 }
 
-static int usbhsc_resume(struct device *dev)
+static __maybe_unused int usbhsc_resume(struct device *dev)
 {
 	struct usbhs_priv *priv = dev_get_drvdata(dev);
 	struct platform_device *pdev = usbhs_priv_to_pdev(priv);
--

2.20.0