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

gpio: xgene: mark PM functions as __maybe_unused

When CONFIG_PM_SLEEP is disabled, we get a warning about unused functions:

drivers/gpio/gpio-xgene.c:155:12: warning: 'xgene_gpio_resume' defined but not used [-Wunused-function]
static int xgene_gpio_resume(struct device *dev)
^~~~~~~~~~~~~~~~~
drivers/gpio/gpio-xgene.c:142:12: warning: 'xgene_gpio_suspend' defined but not used [-Wunused-function]
static int xgene_gpio_suspend(struct device *dev)

The warnings are harmless and can be avoided by simplifying the code and marking
the functions as __maybe_unused.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Arnd Bergmann and committed by
Linus Walleij
b115bebc fa6256db

+3 -10
+3 -10
drivers/gpio/gpio-xgene.c
··· 42 42 struct gpio_chip chip; 43 43 void __iomem *base; 44 44 spinlock_t lock; 45 - #ifdef CONFIG_PM 46 45 u32 set_dr_val[XGENE_MAX_GPIO_BANKS]; 47 - #endif 48 46 }; 49 47 50 48 static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset) ··· 136 138 return 0; 137 139 } 138 140 139 - #ifdef CONFIG_PM 140 - static int xgene_gpio_suspend(struct device *dev) 141 + static __maybe_unused int xgene_gpio_suspend(struct device *dev) 141 142 { 142 143 struct xgene_gpio *gpio = dev_get_drvdata(dev); 143 144 unsigned long bank_offset; ··· 149 152 return 0; 150 153 } 151 154 152 - static int xgene_gpio_resume(struct device *dev) 155 + static __maybe_unused int xgene_gpio_resume(struct device *dev) 153 156 { 154 157 struct xgene_gpio *gpio = dev_get_drvdata(dev); 155 158 unsigned long bank_offset; ··· 163 166 } 164 167 165 168 static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume); 166 - #define XGENE_GPIO_PM_OPS (&xgene_gpio_pm) 167 - #else 168 - #define XGENE_GPIO_PM_OPS NULL 169 - #endif 170 169 171 170 static int xgene_gpio_probe(struct platform_device *pdev) 172 171 { ··· 234 241 .name = "xgene-gpio", 235 242 .of_match_table = xgene_gpio_of_match, 236 243 .acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match), 237 - .pm = XGENE_GPIO_PM_OPS, 244 + .pm = &xgene_gpio_pm, 238 245 }, 239 246 .probe = xgene_gpio_probe, 240 247 };