Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580879 > unrolled thread

[PATCH] gpio: xgene: mark PM functions as __maybe_unused

Started byArnd Bergmann <arnd@arndb.de>
First post2017-02-14 22:30 +0100
Last post2017-02-15 22:40 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] gpio: xgene: mark PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-02-14 22:30 +0100
    Re: [PATCH] gpio: xgene: mark PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-02-15 22:40 +0100

#1580879 — [PATCH] gpio: xgene: mark PM functions as __maybe_unused

FromArnd Bergmann <arnd@arndb.de>
Date2017-02-14 22:30 +0100
Subject[PATCH] gpio: xgene: mark PM functions as __maybe_unused
Message-ID<taSPF-72f-23@gated-at.bofh.it>
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>
---
 drivers/gpio/gpio-xgene.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c
index 40a8881c2ce8..1fd62bef562b 100644
--- a/drivers/gpio/gpio-xgene.c
+++ b/drivers/gpio/gpio-xgene.c
@@ -138,8 +138,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 +151,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 +165,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 +236,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

[toc] | [next] | [standalone]


#1581682

FromArnd Bergmann <arnd@arndb.de>
Date2017-02-15 22:40 +0100
Message-ID<tbfsS-5g5-9@gated-at.bofh.it>
In reply to#1580879
On Tue, Feb 14, 2017 at 10:20 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>

I ran into a problem with this version, please either add this trivial fixup:

diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c
index 1fd62bef562b..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)

or wait for a new version from me.

     Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web