Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: xhci: tegra: mark PM functions as __maybe_unused

The added #ifdefs in the PM rework were almost correct, but still
cause warnings in some randconfig builds:

drivers/usb/host/xhci-tegra.c:2147:12: error: 'tegra_xusb_resume' defined but not used [-Werror=unused-function]
2147 | static int tegra_xusb_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~
drivers/usb/host/xhci-tegra.c:2105:12: error: 'tegra_xusb_suspend' defined but not used [-Werror=unused-function]
2105 | static int tegra_xusb_suspend(struct device *dev)

Replace the #ifdef checks with simpler __maybe_unused annotations to
reliably shut up these warnings.

Link: https://lore.kernel.org/all/20210421135613.3560777-2-arnd@kernel.org/
Fixes: 971ee247060d ("usb: xhci: tegra: Enable ELPG for runtime/system PM")
Reviewed-by: JC Kuo <jckuo@nvidia.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20211005112057.2700888-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Arnd Bergmann and committed by
Greg Kroah-Hartman
3ea75b3f 5816b3e6

+4 -8
+4 -8
drivers/usb/host/xhci-tegra.c
··· 1787 1787 return 0; 1788 1788 } 1789 1789 1790 - #if IS_ENABLED(CONFIG_PM) || IS_ENABLED(CONFIG_PM_SLEEP) 1791 1790 static bool xhci_hub_ports_suspended(struct xhci_hub *hub) 1792 1791 { 1793 1792 struct device *dev = hub->hcd->self.controller; ··· 2101 2102 return err; 2102 2103 } 2103 2104 2104 - static int tegra_xusb_suspend(struct device *dev) 2105 + static __maybe_unused int tegra_xusb_suspend(struct device *dev) 2105 2106 { 2106 2107 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2107 2108 int err; ··· 2143 2144 return err; 2144 2145 } 2145 2146 2146 - static int tegra_xusb_resume(struct device *dev) 2147 + static __maybe_unused int tegra_xusb_resume(struct device *dev) 2147 2148 { 2148 2149 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2149 2150 int err; ··· 2173 2174 2174 2175 return 0; 2175 2176 } 2176 - #endif 2177 2177 2178 - #ifdef CONFIG_PM 2179 - static int tegra_xusb_runtime_suspend(struct device *dev) 2178 + static __maybe_unused int tegra_xusb_runtime_suspend(struct device *dev) 2180 2179 { 2181 2180 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2182 2181 int ret; ··· 2187 2190 return ret; 2188 2191 } 2189 2192 2190 - static int tegra_xusb_runtime_resume(struct device *dev) 2193 + static __maybe_unused int tegra_xusb_runtime_resume(struct device *dev) 2191 2194 { 2192 2195 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2193 2196 int err; ··· 2198 2201 2199 2202 return err; 2200 2203 } 2201 - #endif 2202 2204 2203 2205 static const struct dev_pm_ops tegra_xusb_pm_ops = { 2204 2206 SET_RUNTIME_PM_OPS(tegra_xusb_runtime_suspend,