* [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de> @ 2016-03-02 15:24 ` Arnd Bergmann [not found] ` <1456932255-71725-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb, Arnd Bergmann, Mathias Nyman, Matthias Brugger, linux-mediatek, linux-kernel 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 <arnd@arndb.de> --- drivers/usb/host/xhci-mtk.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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[] = { -- 2.7.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1456932255-71725-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>]
* Re: [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions [not found] ` <1456932255-71725-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> @ 2016-03-04 16:33 ` Matthias Brugger [not found] ` <56D9B8EE.3060107-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Matthias Brugger @ 2016-03-04 16:33 UTC (permalink / raw) To: Arnd Bergmann, Greg Kroah-Hartman Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Felipe Balbi, Alan Stern, linux-usb-u79uwXL29TY76Z2rM5mHXA, Mathias Nyman, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 02/03/16 16:24, Arnd Bergmann wrote: > 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 <arnd-r2nGTMty4D4@public.gmane.org> > --- Reviewed-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > drivers/usb/host/xhci-mtk.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > 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[] = { > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <56D9B8EE.3060107-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions [not found] ` <56D9B8EE.3060107-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-03-10 11:42 ` Mathias Nyman 0 siblings, 0 replies; 3+ messages in thread From: Mathias Nyman @ 2016-03-10 11:42 UTC (permalink / raw) To: Matthias Brugger, Arnd Bergmann, Greg Kroah-Hartman Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Felipe Balbi, Alan Stern, linux-usb-u79uwXL29TY76Z2rM5mHXA, Mathias Nyman, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 04.03.2016 18:33, Matthias Brugger wrote: > > > On 02/03/16 16:24, Arnd Bergmann wrote: >> 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 <arnd-r2nGTMty4D4@public.gmane.org> >> --- > > Reviewed-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Acked-by: Mathias Nyman <mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-10 11:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
2016-03-02 15:24 ` [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions Arnd Bergmann
[not found] ` <1456932255-71725-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2016-03-04 16:33 ` Matthias Brugger
[not found] ` <56D9B8EE.3060107-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-10 11:42 ` Mathias Nyman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).