Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dac5300 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman
Browse files

usb: xhci-mtk: use __maybe_unused to hide pm functions



The mediatek XHCI glue driver uses SET_SYSTEM_SLEEP_PM_OPS() to
conditionally set the correct suspend/resume options, and
also puts both the dev_pm_ops and the functions inside of
an #ifdef testing for CONFIG_PM_SLEEP, but those functions
then call other code that becomes unused:

drivers/usb/host/xhci-mtk.c:135:12: error: 'xhci_mtk_host_disable' defined but not used [-Werror=unused-function]
drivers/usb/host/xhci-mtk.c:313:13: error: 'usb_wakeup_enable' defined but not used [-Werror=unused-function]
drivers/usb/host/xhci-mtk.c:321:13: error: 'usb_wakeup_disable' defined but not used [-Werror=unused-function]

This replaces the #ifdef with __maybe_unused annotations so the
compiler knows it can silently drop them instead of warning.

For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
to avoid defining the structure when CONFIG_PM is not set without
the #ifdef.

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c88d4df2
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -695,7 +695,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
	return 0;
	return 0;
}
}


#ifdef CONFIG_PM_SLEEP
/*
/*
 * if ip sleep fails, and all clocks are disabled, access register will hang
 * if ip sleep fails, and all clocks are disabled, access register will hang
 * AHB bus, so stop polling roothubs to avoid regs access on bus suspend.
 * AHB bus, so stop polling roothubs to avoid regs access on bus suspend.
@@ -703,7 +702,7 @@ static int xhci_mtk_remove(struct platform_device *dev)
 * to wake up system immediately after system suspend complete if ip sleep
 * to wake up system immediately after system suspend complete if ip sleep
 * fails, it is what we wanted.
 * fails, it is what we wanted.
 */
 */
static int xhci_mtk_suspend(struct device *dev)
static int __maybe_unused xhci_mtk_suspend(struct device *dev)
{
{
	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
	struct usb_hcd *hcd = mtk->hcd;
	struct usb_hcd *hcd = mtk->hcd;
@@ -722,7 +721,7 @@ static int xhci_mtk_suspend(struct device *dev)
	return 0;
	return 0;
}
}


static int xhci_mtk_resume(struct device *dev)
static int __maybe_unused xhci_mtk_resume(struct device *dev)
{
{
	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
	struct usb_hcd *hcd = mtk->hcd;
	struct usb_hcd *hcd = mtk->hcd;
@@ -744,10 +743,7 @@ static int xhci_mtk_resume(struct device *dev)
static const struct dev_pm_ops xhci_mtk_pm_ops = {
static const struct dev_pm_ops xhci_mtk_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(xhci_mtk_suspend, xhci_mtk_resume)
	SET_SYSTEM_SLEEP_PM_OPS(xhci_mtk_suspend, xhci_mtk_resume)
};
};
#define DEV_PM_OPS	(&xhci_mtk_pm_ops)
#define DEV_PM_OPS IS_ENABLED(CONFIG_PM) ? &xhci_mtk_pm_ops : NULL
#else
#define DEV_PM_OPS	NULL
#endif /* CONFIG_PM */


#ifdef CONFIG_OF
#ifdef CONFIG_OF
static const struct of_device_id mtk_xhci_of_match[] = {
static const struct of_device_id mtk_xhci_of_match[] = {