2018-12-13 03:23:12

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next] usb: renesas_usbhs: Fix unused function warning when CONFIG_PM not set

with CONFIG_PM not set, gcc warning this:
drivers/usb/renesas_usbhs/common.c:844:12:
warning: 'usbhsc_suspend' defined but not used [-Wunused-function]
drivers/usb/renesas_usbhs/common.c:860:12:
warning: 'usbhsc_resume' defined but not used [-Wunused-function]

fix this by adding #ifdef around it.

Signed-off-by: YueHaibing <[email protected]>
---
drivers/usb/renesas_usbhs/common.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 02c1d2b..9390c76 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -841,6 +841,7 @@ static int usbhs_remove(struct platform_device *pdev)
return 0;
}

+#ifdef CONFIG_PM
static int usbhsc_suspend(struct device *dev)
{
struct usbhs_priv *priv = dev_get_drvdata(dev);
@@ -873,6 +874,7 @@ static int usbhsc_resume(struct device *dev)

return 0;
}
+#endif

static SIMPLE_DEV_PM_OPS(usbhsc_pm_ops, usbhsc_suspend, usbhsc_resume);

--
2.7.4




2018-12-13 03:42:48

by Yoshihiro Shimoda

[permalink] [raw]
Subject: RE: [PATCH -next] usb: renesas_usbhs: Fix unused function warning when CONFIG_PM not set

Hi,

> From: YueHaibing, Sent: Thursday, December 13, 2018 12:19 PM
>
> with CONFIG_PM not set, gcc warning this:
> drivers/usb/renesas_usbhs/common.c:844:12:
> warning: 'usbhsc_suspend' defined but not used [-Wunused-function]
> drivers/usb/renesas_usbhs/common.c:860:12:
> warning: 'usbhsc_resume' defined but not used [-Wunused-function]
>
> fix this by adding #ifdef around it.
>
> Signed-off-by: YueHaibing <[email protected]>

Thank you for the patch.
However, this issue is already fixed on the Greg's usb.git / usb-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=eaf3074e0a8c2a39c4c14aa8ef1c2ec09ace9c79

Best regards,
Yoshihiro Shimoda