pinctrl: avoid duplicate function definitions
Subsystems (2)
PATCH 1/1 pinctrl: avoid duplicate function definitions
From: Arnd Bergmann <[email protected]>
The pinctrl_generic_to_map() and pinctrl_generic_pins_function_dt_node_to_map() functions are built whenever CONFIG_GENERIC_PINCTRL is enabled, including configurations without CONFIG_OF.
When CONFIG_OF is disabled, the dummy definitions are also present in the header, which causes the build to fail:
drivers/pinctrl/pinctrl-generic.c:20:5: error: conflicting types for 'pinctrl_generic_to_map'; have 'int(struct pinctrl_dev *, struct device_node *, struct device_node *, struct pinctrl_map **, unsigned int *, unsigned int *, const char **, unsigned int, const char **, unsigned int *, unsigned int)'
20 | int pinctrl_generic_to_map(struct pinctrl_dev *pctldev, struct device_node *parent,
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/pinctrl/pinctrl-generic.c:16:
drivers/pinctrl/pinconf.h:193:1: note: previous definition of 'pinctrl_generic_to_map' with type 'int(struct pinctrl_dev *, struct device_node *, struct device_node *, struct pinctrl_map **, unsigned int *, unsigned int *, const char **, unsigned int, const char **, unsigned int *, void *)'
193 | pinctrl_generic_to_map(struct pinctrl_dev *pctldev, struct device_node *parent,
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-generic.c:130:5: error: redefinition of 'pinctrl_generic_pins_function_dt_node_to_map'
130 | int pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/pinconf.h:184:1: note: previous definition of 'pinctrl_generic_pins_function_dt_node_to_map' with type 'int(struct pinctrl_dev *, struct device_node *, struct pinctrl_map **, unsigned int *)'
184 | pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Removing either set of definitions is sufficient to avoid the problem.
Remove the copy from the header for simplicity.
--- drivers/pinctrl/pinconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinconf.h +1 -1
@@ -167,7 +167,7 @@ pinconf_generic_parse_dt_pinmux(struct device_node *np, struct device *dev, }#endif -#if defined(CONFIG_GENERIC_PINCTRL ) && defined (CONFIG_OF ) +#if defined(CONFIG_GENERIC_PINCTRL ) int pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np, struct pinctrl_map **maps,
Signature · 1 line
2.39.5
Quoted 23 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The
pinctrl_generic_to_map()andpinctrl_generic_pins_function_dt_node_to_map()functions are built wheneverCONFIG_GENERIC_PINCTRLis enabled, including configurations withoutCONFIG_OF.When
CONFIG_OFis disabled, the dummy definitions are also present in the header, which causes the build to fail:
drivers/pinctrl/pinctrl-generic.c:20:5: error: conflicting types for 'pinctrl_generic_to_map'; have 'int(structpinctrl_dev*, structdevice_node*, structdevice_node*, structpinctrl_map**, unsigned int *, unsigned int *, const char **, unsigned int, const char **, unsigned int *, unsigned int)'
20 | int pinctrl_generic_to_map(structpinctrl_dev*pctldev, structdevice_node*parent,| ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/pinctrl/pinctrl-generic.c:16: drivers/pinctrl/pinconf.h:193:1: note: previous definition of 'pinctrl_generic_to_map' with type 'int(struct pinctrl_dev *, struct device_node *, struct device_node *, struct pinctrl_map **, unsigned int *, unsigned int *, const char **, unsigned int, const char **, unsigned int *, void *)' 193 | pinctrl_generic_to_map(struct pinctrl_dev *pctldev, struct device_node *parent, | ^~~~~~~~~~~~~~~~~~~~~~ drivers/pinctrl/pinctrl-generic.c:130:5: error: redefinition of 'pinctrl_generic_pins_function_dt_node_to_map' 130 | int pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pinctrl/pinconf.h:184:1: note: previous definition of 'pinctrl_generic_pins_function_dt_node_to_map' with type 'int(struct pinctrl_dev *, struct device_node *, struct pinctrl_map **, unsigned int *)' 184 | pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines
Removing either set of definitions is sufficient to avoid the problem.
Remove the copy from the header for simplicity.
Fixes aaaf31be0426 ("pinctrl: extract pinctrl_generic_to_map() from pinctrl_generic_pins_function_dt_node_to_map()")Fixes 43722575e5cd ("pinctrl: add generic functions + pins mapper")Signed-off-by Arnd Bergmann <[email protected]>
And all of the of functions it uses have NOP variants don't they, so this is the correct fix from a build coverage point of view.
Cheers,
Conor.
Quoted 20 lines
--- drivers/pinctrl/pinconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/pinconf.h +1
-1@@ -167,7 +167,7 @@ pinconf_generic_parse_dt_pinmux(struct device_node *np, struct device *dev, }#endif -#if defined(CONFIG_GENERIC_PINCTRL ) && defined (CONFIG_OF ) +#if defined(CONFIG_GENERIC_PINCTRL ) int pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np, struct pinctrl_map **maps,Signature · 1 line
2.39.5
Quoted 4 lines · Conor Dooley
On Wed, May 20, 2026 at 09:51:14AM +0200, Arnd Bergmann wrote:
And all of the of functions it uses have NOP variants don't they, so this is the correct fix from a build coverage point of view.
Yes, I verified that the code builds fine in random configurations including those without CONFIG_OF.
Quoted 1 line
Acked-by Conor Dooley <[email protected]>
Thanks,
Arnd