All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] gpio: xgene: mark PM functions as __maybe_unused
@ 2017-03-14 12:57 Arnd Bergmann
  2017-03-15 13:47 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-03-14 12:57 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: Arnd Bergmann, Axel Lin, Duc Dang, Paul Gortmaker, linux-gpio,
	linux-kernel

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>
---
Originally submitted on Feb 17, but it ended up not getting merged into v4.11-rc2
and is still needed there for randconfig builds
---
 drivers/gpio/gpio-xgene.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c
index 40a8881c2ce8..f1c6ec17b90a 100644
--- a/drivers/gpio/gpio-xgene.c
+++ b/drivers/gpio/gpio-xgene.c
@@ -42,9 +42,7 @@ struct xgene_gpio {
 	struct gpio_chip	chip;
 	void __iomem		*base;
 	spinlock_t		lock;
-#ifdef CONFIG_PM
 	u32			set_dr_val[XGENE_MAX_GPIO_BANKS];
-#endif
 };
 
 static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset)
@@ -138,8 +136,7 @@ static int xgene_gpio_dir_out(struct gpio_chip *gc,
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int xgene_gpio_suspend(struct device *dev)
+static __maybe_unused int xgene_gpio_suspend(struct device *dev)
 {
 	struct xgene_gpio *gpio = dev_get_drvdata(dev);
 	unsigned long bank_offset;
@@ -152,7 +149,7 @@ static int xgene_gpio_suspend(struct device *dev)
 	return 0;
 }
 
-static int xgene_gpio_resume(struct device *dev)
+static __maybe_unused int xgene_gpio_resume(struct device *dev)
 {
 	struct xgene_gpio *gpio = dev_get_drvdata(dev);
 	unsigned long bank_offset;
@@ -166,10 +163,6 @@ static int xgene_gpio_resume(struct device *dev)
 }
 
 static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
-#define XGENE_GPIO_PM_OPS	(&xgene_gpio_pm)
-#else
-#define XGENE_GPIO_PM_OPS	NULL
-#endif
 
 static int xgene_gpio_probe(struct platform_device *pdev)
 {
@@ -241,7 +234,7 @@ static struct platform_driver xgene_gpio_driver = {
 		.name = "xgene-gpio",
 		.of_match_table = xgene_gpio_of_match,
 		.acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match),
-		.pm     = XGENE_GPIO_PM_OPS,
+		.pm     = &xgene_gpio_pm,
 	},
 	.probe = xgene_gpio_probe,
 };
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] gpio: xgene: mark PM functions as __maybe_unused
  2017-03-14 12:57 [RESEND PATCH] gpio: xgene: mark PM functions as __maybe_unused Arnd Bergmann
@ 2017-03-15 13:47 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2017-03-15 13:47 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexandre Courbot, Axel Lin, Duc Dang, Paul Gortmaker,
	linux-gpio, linux-kernel

On Tue, Mar 14, 2017 at 1:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> 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>
> ---
> Originally submitted on Feb 17, but it ended up not getting merged into v4.11-rc2
> and is still needed there for randconfig builds

Yeah I have it queued but just too much to do. I hope to be able to
send a pull request for this & more soon.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-15 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14 12:57 [RESEND PATCH] gpio: xgene: mark PM functions as __maybe_unused Arnd Bergmann
2017-03-15 13:47 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.