Skip to contentSkip to conversation

drivers/gpio/nomadik: move dummy nmk_gpio_dbg_show_one() to header

PATCH In review Max Kellermann 2 participants 2 messages Mar 11, 2024 – Mar 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/gpio/nomadik: move dummy nmk_gpio_dbg_show_one() to header

When CONFIG_DEBUG_FS is disabled, nmk_gpio_dbg_show_one() is an empty dummy function; this however triggers a -Wmissing-prototypes warning and later a linker error because the function is also used by drivers/pinctrl/nomadik/pinctrl-nomadik.c, therefore it needs to be non-static.

To allow both sources to access this dummy function, this patch moves it to the header, adding the #ifdef CONFIG_DEBUG_FS there as well.

---
 drivers/gpio/gpio-nomadik.c       |  8 --------
 include/linux/gpio/gpio-nomadik.h | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/gpio/gpio-nomadik.c +0 -8
index 463a765620dc..9637ede8ab43 100644
@@ -486,14 +486,6 @@ static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 
 #else
 
-static inline void nmk_gpio_dbg_show_one(struct seq_file *s,
-					 struct pinctrl_dev *pctldev,
-					 struct gpio_chip *chip,
-					 unsigned int offset,
-					 unsigned int gpio)
-{
-}
-
 #define nmk_gpio_dbg_show	NULL
 
 #endif
include/linux/gpio/gpio-nomadik.h +15 -0
index 4a95ea7935fb..b5a84864650d 100644
@@ -253,6 +253,8 @@ nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data **soc)
 
 struct platform_device;
 
+#ifdef CONFIG_DEBUG_FS
+
 /*
  * Symbols declared in gpio-nomadik used by pinctrl-nomadik. If pinctrl-nomadik
  * is enabled, then gpio-nomadik is enabled as well; the reverse if not always
@@ -261,6 +263,19 @@ struct platform_device;
 void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
 			   struct gpio_chip *chip, unsigned int offset,
 			   unsigned int gpio);
+
+#else
+
+static inline void nmk_gpio_dbg_show_one(struct seq_file *s,
+					 struct pinctrl_dev *pctldev,
+					 struct gpio_chip *chip,
+					 unsigned int offset,
+					 unsigned int gpio)
+{
+}
+
+#endif
+
 void __nmk_gpio_make_output(struct nmk_gpio_chip *nmk_chip,
 			    unsigned int offset, int val);
 void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip, unsigned int offset,
Signature · 1 line
2.39.2
#1 lore raw
Quoted 10 lines · Max Kellermann

When CONFIG_DEBUG_FS is disabled, nmk_gpio_dbg_show_one() is an empty dummy function; this however triggers a -Wmissing-prototypes warning and later a linker error because the function is also used by drivers/pinctrl/nomadik/pinctrl-nomadik.c, therefore it needs to be non-static.

To allow both sources to access this dummy function, this patch moves it to the header, adding the #ifdef CONFIG_DEBUG_FS there as well.

I made a patch myself yesterday and applied, but I like your patch more so I took out my patch and put in yours instead.

Thanks!

Yours,
Linus Walleij