Skip to contentSkip to conversation

gpio: turn of_pinctrl_get() into a static inline

PATCH In review Stephen Rothwell 3 participants 5 messages Apr 1, 2020

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

PATCH 1/1 gpio: turn of_pinctrl_get() into a static inline

This avoids the overheads of an EXPORTed function.

---
 drivers/pinctrl/devicetree.c    | 6 ------
 include/linux/pinctrl/pinctrl.h | 9 +++------
 2 files changed, 3 insertions(+), 12 deletions(-)

This is not even build tested, but is this what you meant, Geert?

drivers/pinctrl/devicetree.c +0 -6
index c6fe7d64c913..61abff89e5f8 100644
@@ -99,12 +99,6 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,
 	return -ENOMEM;
 }
 
-struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
-{
-	return get_pinctrl_dev_from_of_node(np);
-}
-EXPORT_SYMBOL_GPL(of_pinctrl_get);
-
 static int dt_to_map_one_config(struct pinctrl *p,
 				struct pinctrl_dev *hog_pctldev,
 				const char *statename,
include/linux/pinctrl/pinctrl.h +3 -6
index 2aef59df93d7..e7b5cd5e1b10 100644
@@ -186,15 +186,12 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
 				const char *pin_group, const unsigned **pins,
 				unsigned *num_pins);
 
-#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL)
-extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
-#else
-static inline
-struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
+static inline struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
 {
+	if (IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL))
+		return get_pinctrl_dev_from_of_node(np);
 	return NULL;
 }
-#endif /* CONFIG_OF */
 
 extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);
 extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev);
Signature · 5 lines
2.26.0

-- 
Cheers,
Stephen Rothwell
#1 lore raw

Hi all,

Quoted 11 lines · On Wed, 1 Apr 2020 19:08:10 +1100 Stephen Rothwell <[email protected]> wrote:

This avoids the overheads of an EXPORTed function.

---
 drivers/pinctrl/devicetree.c    | 6 ------
 include/linux/pinctrl/pinctrl.h | 9 +++------
 2 files changed, 3 insertions(+), 12 deletions(-)

This is not even build tested, but is this what you meant, Geert?

Actually this won't work because get_pinctrl_dev_from_of_node() is declared in the private header file drivers/pinctrl/core.h :-(

Signature · 2 lines
Cheers,
Stephen Rothwell
#2 lore raw
Quoted 11 lines · Stephen Rothwell
Quoted 10 lines · On Wed, 1 Apr 2020 19:08:10 +1100 Stephen Rothwell <[email protected]> wrote:

This avoids the overheads of an EXPORTed function.

---
 drivers/pinctrl/devicetree.c    | 6 ------
 include/linux/pinctrl/pinctrl.h | 9 +++------
 2 files changed, 3 insertions(+), 12 deletions(-)
Quoted 4 lines
Quoted 1 line

This is not even build tested, but is this what you meant, Geert?

Actually this won't work because get_pinctrl_dev_from_of_node() is declared in the private header file drivers/pinctrl/core.h :-(

No big deal. We keep your other fix for now.

Yours,
Linus Walleij

#3 lore raw
In reply to Stephen Rothwell

Hi Stephen,

Quoted 10 lines · Stephen Rothwell
Quoted 9 lines · On Wed, 1 Apr 2020 19:08:10 +1100 Stephen Rothwell <[email protected]> wrote:

This avoids the overheads of an EXPORTed function.

---
 drivers/pinctrl/devicetree.c    | 6 ------
 include/linux/pinctrl/pinctrl.h | 9 +++------
 2 files changed, 3 insertions(+), 12 deletions(-)
Quoted 4 lines
Quoted 1 line

This is not even build tested, but is this what you meant, Geert?

Actually this won't work because get_pinctrl_dev_from_of_node() is declared in the private header file drivers/pinctrl/core.h :-(

Indeed :-(

Just realized this myself, while reviewing your patch. Sorry for the bad suggestion.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw

Hi Geert,

Quoted 3 lines · On Wed, 1 Apr 2020 10:26:58 +0200 Geert Uytterhoeven <[email protected]>…

Just realized this myself, while reviewing your patch. Sorry for the bad suggestion.

No worries.

Signature · 2 lines
Cheers,
Stephen Rothwell