From patchwork Wed Mar 2 15:24:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102628 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2443551lbc; Wed, 2 Mar 2016 07:25:31 -0800 (PST) X-Received: by 10.98.33.28 with SMTP id h28mr35548154pfh.54.1456932331339; Wed, 02 Mar 2016 07:25:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s73si10324089pfs.11.2016.03.02.07.25.31; Wed, 02 Mar 2016 07:25:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754982AbcCBPZ1 (ORCPT + 30 others); Wed, 2 Mar 2016 10:25:27 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:49364 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752989AbcCBPZX (ORCPT ); Wed, 2 Mar 2016 10:25:23 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0LckK3-1a8z183yv1-00k7Gh; Wed, 02 Mar 2016 16:24:46 +0100 From: Arnd Bergmann To: Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, Felipe Balbi , Alan Stern , linux-usb@vger.kernel.org, Arnd Bergmann , Mathias Nyman , Matthias Brugger , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions Date: Wed, 2 Mar 2016 16:24:04 +0100 Message-Id: <1456932255-71725-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456932255-71725-1-git-send-email-arnd@arndb.de> References: <1456932255-71725-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:WOQMNubjm2QiLxgVapVtgQBWZr86oyekUak4cRaHzroSFZQ36Ca ZLH+9e8aO/vc6AjXc7nFGdZYSNHP4Q9dH1D/7d0Qe3LM9qQ1xzO2vBtKdEyXHxK0jlcKqNV nZYPI21o/TNSAcR8wLdY6cMbAKbSZ47L6Y2CsVJk5bzf+/noFX15LJ1SpjU0nCwzVU7ufJ1 WF80sIElatFSjCipSz4NQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ICRVgl+XYFU=:je0jeCtJHj12zTh/rdpggt l8Vv7sqPvLZNBPmHSbcstbqRnQZy5R7Hicd2rQXtM9x74jEriJ0WXApf3zdrlgu8F0vfeBNav bAKYecu7Ulk2Vad1ZjB8Of5XQnJdKewmYcT+0DIBJhTvN3yNzH/zelCy0by3SzuYdf+JK1+eO Lem9NNrp31CtVKdB9TaRTNZmbotIiuwakviDEIe5URVMhG/qMtjj3yVNTSXcjKUDCk+/LXm/G UYfvXe0tXXjbkIDBqIHcV7HaALwz3QxkGYJ2e9y+8xnCSgMfRjB9Jywz4eil4F7lml2C8wUFF gcDW9BAEROuVp1PSoqUmg0oQqOV6JQy97/1NoLhw9jU1RsDMJ3tE7xWMzVRkk5ZdkQOSWqsKQ LeaxIlU5BOO+0q+Q4YEryFYA0OxEpBxAMxXEcaXiH8wy2INl1y5JuyImLpx8voPHctFOiziiF bb8hzqg8tqcJqDSNm//K+D7kSdykAMfAuVw0BVFkhgNXs0KG1G8WkGqUungkTMCs1lWQg8Wa1 uH1iHbLfCLmBcqJrhr+6OQ9D/34TVOQx35z7tg6eEQYhNfybHgpiv4rBA+3uC1NsaJW4eofmK Z/zV8/ufRJhzfaac8Us7w6AjsFLkVY0RZq4lOWD0P34t4s1d+SXRTUUvdS1qzBe/GW3duPcB6 vkwobT52BR6KLWCRJMea8LqPKMU9I+KMGCTxM4tt9q0MrFip9cI34XVt0B/cnnLMjSlA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Arnd Bergmann --- drivers/usb/host/xhci-mtk.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) -- 2.7.0 diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 9532f5aef71b..79959f17c38c 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -695,7 +695,6 @@ static int xhci_mtk_remove(struct platform_device *dev) return 0; } -#ifdef CONFIG_PM_SLEEP /* * 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. @@ -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 * 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 usb_hcd *hcd = mtk->hcd; @@ -722,7 +721,7 @@ static int xhci_mtk_suspend(struct device *dev) 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 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 = { SET_SYSTEM_SLEEP_PM_OPS(xhci_mtk_suspend, xhci_mtk_resume) }; -#define DEV_PM_OPS (&xhci_mtk_pm_ops) -#else -#define DEV_PM_OPS NULL -#endif /* CONFIG_PM */ +#define DEV_PM_OPS IS_ENABLED(CONFIG_PM) ? &xhci_mtk_pm_ops : NULL #ifdef CONFIG_OF static const struct of_device_id mtk_xhci_of_match[] = {