Skip to contentSkip to conversation

pinctrl: Export some needed symbols at module load time

PATCH In review Baolin Wang 4 participants 8 messages Feb 27, 2020 – Mar 3, 2020

Subsystems (3)
lore
Share & tools
lore

Baolin Wang

author maintainer
#0 lore raw

PATCH 1/2 pinctrl: Export some needed symbols at module load time

Export the pin_get_name()/pinconf_generic_parse_dt_config() symbols needed by the Spreadtrum pinctrl driver when building it as a module.

---
 drivers/pinctrl/core.c            | 1 +
 drivers/pinctrl/pinconf-generic.c | 1 +
 2 files changed, 2 insertions(+)
drivers/pinctrl/core.c +1 -0
index 446d84f..893b1ac 100644
@@ -176,6 +176,7 @@ const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin)
 
 	return desc->name;
 }
+EXPORT_SYMBOL_GPL(pin_get_name);
 
 /* Deletes a range of pin descriptors */
 static void pinctrl_free_pindescs(struct pinctrl_dev *pctldev,
drivers/pinctrl/pinconf-generic.c +1 -0
index 9eb8630..dfef471 100644
@@ -286,6 +286,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
 	kfree(cfg);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(pinconf_generic_parse_dt_config);
 
 int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev,
 		struct device_node *np, struct pinctrl_map **map,
Signature · 1 line
1.9.1
author maintainer
#1 lore raw

PATCH 2/2 pinctrl: sprd: Allow the SPRD pinctrl driver building into a module

Change the config to 'tristate' and export some symbols needed by modules to allow the Spreadtrum pinctrl driver building into a module.

---
 drivers/pinctrl/sprd/Kconfig        | 6 +++---
 drivers/pinctrl/sprd/pinctrl-sprd.c | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/pinctrl/sprd/Kconfig +3 -3
index b6c5479..c9e7f0b 100644
@@ -4,7 +4,7 @@
 #
 
 config PINCTRL_SPRD
-	bool "Spreadtrum pinctrl driver"
+	tristate "Spreadtrum pinctrl driver"
 	depends on OF
 	depends on ARCH_SPRD || COMPILE_TEST
 	select PINMUX
@@ -15,7 +15,7 @@ config PINCTRL_SPRD
 	  Say Y here to enable Spreadtrum pinctrl driver
 
 config PINCTRL_SPRD_SC9860
-	bool "Spreadtrum SC9860 pinctrl driver"
-	depends on PINCTRL_SPRD
+	tristate "Spreadtrum SC9860 pinctrl driver"
+	select PINCTRL_SPRD
 	help
 	  Say Y here to enable Spreadtrum SC9860 pinctrl driver
drivers/pinctrl/sprd/pinctrl-sprd.c +3 -0
index 157712ab..ea04bac 100644
@@ -1090,6 +1090,7 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(sprd_pinctrl_core_probe);
 
 int sprd_pinctrl_remove(struct platform_device *pdev)
 {
@@ -1098,6 +1099,7 @@ int sprd_pinctrl_remove(struct platform_device *pdev)
 	pinctrl_unregister(sprd_pctl->pctl);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(sprd_pinctrl_remove);
 
 void sprd_pinctrl_shutdown(struct platform_device *pdev)
 {
@@ -1112,6 +1114,7 @@ void sprd_pinctrl_shutdown(struct platform_device *pdev)
 		return;
 	pinctrl_select_state(pinctl, state);
 }
+EXPORT_SYMBOL_GPL(sprd_pinctrl_shutdown);
 
 MODULE_DESCRIPTION("SPREADTRUM Pin Controller Driver");
 MODULE_AUTHOR("Baolin Wang <[email protected]>");
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/2] pinctrl: sprd: Allow the SPRD pinctrl driver building into a module

Quoted 4 lines · Baolin Wang

Change the config to 'tristate' and export some symbols needed by modules to allow the Spreadtrum pinctrl driver building into a module.

Patch applied.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH 2/2] pinctrl: sprd: Allow the SPRD pinctrl driver building into a module

In reply to Baolin Wang
I love your patch! Yet something to improve:

Hi Baolin,

I love your patch! Yet something to improve:

[auto build test ERROR on pinctrl/devel]
[also build test ERROR on v5.6-rc3 next-20200228]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Baolin-Wang/pinctrl-Export-some-needed-symbols-at-module-load-time/20200227-121948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: i386-randconfig-d003-20200229 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers/pinctrl/sprd/pinctrl-sprd.c: In function 'sprd_dt_node_to_map':

>> drivers/pinctrl/sprd/pinctrl-sprd.c:282:8: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Werror=implicit-function-declaration]

ret = pinconf_generic_parse_dt_config(np, pctldev, &configs,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pinconf_generic_dump_config
cc1: some warnings being treated as errors

vim +282 drivers/pinctrl/sprd/pinctrl-sprd.c

41d32cfce1ae61 Baolin Wang 2017-08-17  241  
41d32cfce1ae61 Baolin Wang 2017-08-17  242  static int sprd_dt_node_to_map(struct pinctrl_dev *pctldev,
41d32cfce1ae61 Baolin Wang 2017-08-17  243  			       struct device_node *np,
41d32cfce1ae61 Baolin Wang 2017-08-17  244  			       struct pinctrl_map **map,
41d32cfce1ae61 Baolin Wang 2017-08-17  245  			       unsigned int *num_maps)
41d32cfce1ae61 Baolin Wang 2017-08-17  246  {
41d32cfce1ae61 Baolin Wang 2017-08-17  247  	struct sprd_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
41d32cfce1ae61 Baolin Wang 2017-08-17  248  	const struct sprd_pin_group *grp;
41d32cfce1ae61 Baolin Wang 2017-08-17  249  	unsigned long *configs = NULL;
41d32cfce1ae61 Baolin Wang 2017-08-17  250  	unsigned int num_configs = 0;
41d32cfce1ae61 Baolin Wang 2017-08-17  251  	unsigned int reserved_maps = 0;
41d32cfce1ae61 Baolin Wang 2017-08-17  252  	unsigned int reserve = 0;
41d32cfce1ae61 Baolin Wang 2017-08-17  253  	const char *function;
41d32cfce1ae61 Baolin Wang 2017-08-17  254  	enum pinctrl_map_type type;
41d32cfce1ae61 Baolin Wang 2017-08-17  255  	int ret;
41d32cfce1ae61 Baolin Wang 2017-08-17  256  
41d32cfce1ae61 Baolin Wang 2017-08-17  257  	grp = sprd_pinctrl_find_group_by_name(pctl, np->name);
41d32cfce1ae61 Baolin Wang 2017-08-17  258  	if (!grp) {
41d32cfce1ae61 Baolin Wang 2017-08-17  259  		dev_err(pctl->dev, "unable to find group for node %s\n",
41d32cfce1ae61 Baolin Wang 2017-08-17  260  			of_node_full_name(np));
41d32cfce1ae61 Baolin Wang 2017-08-17  261  		return -EINVAL;
41d32cfce1ae61 Baolin Wang 2017-08-17  262  	}
41d32cfce1ae61 Baolin Wang 2017-08-17  263  
41d32cfce1ae61 Baolin Wang 2017-08-17  264  	ret = of_property_count_strings(np, "pins");
41d32cfce1ae61 Baolin Wang 2017-08-17  265  	if (ret < 0)
41d32cfce1ae61 Baolin Wang 2017-08-17  266  		return ret;
41d32cfce1ae61 Baolin Wang 2017-08-17  267  
41d32cfce1ae61 Baolin Wang 2017-08-17  268  	if (ret == 1)
41d32cfce1ae61 Baolin Wang 2017-08-17  269  		type = PIN_MAP_TYPE_CONFIGS_PIN;
41d32cfce1ae61 Baolin Wang 2017-08-17  270  	else
41d32cfce1ae61 Baolin Wang 2017-08-17  271  		type = PIN_MAP_TYPE_CONFIGS_GROUP;
41d32cfce1ae61 Baolin Wang 2017-08-17  272  
41d32cfce1ae61 Baolin Wang 2017-08-17  273  	ret = of_property_read_string(np, "function", &function);
41d32cfce1ae61 Baolin Wang 2017-08-17  274  	if (ret < 0) {
41d32cfce1ae61 Baolin Wang 2017-08-17  275  		if (ret != -EINVAL)
41d32cfce1ae61 Baolin Wang 2017-08-17  276  			dev_err(pctl->dev,
41d32cfce1ae61 Baolin Wang 2017-08-17  277  				"%s: could not parse property function\n",
41d32cfce1ae61 Baolin Wang 2017-08-17  278  				of_node_full_name(np));
41d32cfce1ae61 Baolin Wang 2017-08-17  279  		function = NULL;
41d32cfce1ae61 Baolin Wang 2017-08-17  280  	}
41d32cfce1ae61 Baolin Wang 2017-08-17  281  
41d32cfce1ae61 Baolin Wang 2017-08-17 @282  	ret = pinconf_generic_parse_dt_config(np, pctldev, &configs,
41d32cfce1ae61 Baolin Wang 2017-08-17  283  					      &num_configs);
41d32cfce1ae61 Baolin Wang 2017-08-17  284  	if (ret < 0) {
41d32cfce1ae61 Baolin Wang 2017-08-17  285  		dev_err(pctl->dev, "%s: could not parse node property\n",
41d32cfce1ae61 Baolin Wang 2017-08-17  286  			of_node_full_name(np));
41d32cfce1ae61 Baolin Wang 2017-08-17  287  		return ret;
41d32cfce1ae61 Baolin Wang 2017-08-17  288  	}
41d32cfce1ae61 Baolin Wang 2017-08-17  289  
41d32cfce1ae61 Baolin Wang 2017-08-17  290  	*map = NULL;
41d32cfce1ae61 Baolin Wang 2017-08-17  291  	*num_maps = 0;
41d32cfce1ae61 Baolin Wang 2017-08-17  292  
41d32cfce1ae61 Baolin Wang 2017-08-17  293  	if (function != NULL)
41d32cfce1ae61 Baolin Wang 2017-08-17  294  		reserve++;
41d32cfce1ae61 Baolin Wang 2017-08-17  295  	if (num_configs)
41d32cfce1ae61 Baolin Wang 2017-08-17  296  		reserve++;
41d32cfce1ae61 Baolin Wang 2017-08-17  297  
41d32cfce1ae61 Baolin Wang 2017-08-17  298  	ret = pinctrl_utils_reserve_map(pctldev, map, &reserved_maps,
41d32cfce1ae61 Baolin Wang 2017-08-17  299  					num_maps, reserve);
41d32cfce1ae61 Baolin Wang 2017-08-17  300  	if (ret < 0)
41d32cfce1ae61 Baolin Wang 2017-08-17  301  		goto out;
41d32cfce1ae61 Baolin Wang 2017-08-17  302  
41d32cfce1ae61 Baolin Wang 2017-08-17  303  	if (function) {
41d32cfce1ae61 Baolin Wang 2017-08-17  304  		ret = pinctrl_utils_add_map_mux(pctldev, map,
41d32cfce1ae61 Baolin Wang 2017-08-17  305  						&reserved_maps, num_maps,
41d32cfce1ae61 Baolin Wang 2017-08-17  306  						grp->name, function);
41d32cfce1ae61 Baolin Wang 2017-08-17  307  		if (ret < 0)
41d32cfce1ae61 Baolin Wang 2017-08-17  308  			goto out;
41d32cfce1ae61 Baolin Wang 2017-08-17  309  	}
41d32cfce1ae61 Baolin Wang 2017-08-17  310  
41d32cfce1ae61 Baolin Wang 2017-08-17  311  	if (num_configs) {
41d32cfce1ae61 Baolin Wang 2017-08-17  312  		const char *group_or_pin;
41d32cfce1ae61 Baolin Wang 2017-08-17  313  		unsigned int pin_id;
41d32cfce1ae61 Baolin Wang 2017-08-17  314  
41d32cfce1ae61 Baolin Wang 2017-08-17  315  		if (type == PIN_MAP_TYPE_CONFIGS_PIN) {
41d32cfce1ae61 Baolin Wang 2017-08-17  316  			pin_id = grp->pins[0];
41d32cfce1ae61 Baolin Wang 2017-08-17  317  			group_or_pin = pin_get_name(pctldev, pin_id);
41d32cfce1ae61 Baolin Wang 2017-08-17  318  		} else {
41d32cfce1ae61 Baolin Wang 2017-08-17  319  			group_or_pin = grp->name;
41d32cfce1ae61 Baolin Wang 2017-08-17  320  		}
41d32cfce1ae61 Baolin Wang 2017-08-17  321  
41d32cfce1ae61 Baolin Wang 2017-08-17  322  		ret = pinctrl_utils_add_map_configs(pctldev, map,
41d32cfce1ae61 Baolin Wang 2017-08-17  323  						    &reserved_maps, num_maps,
41d32cfce1ae61 Baolin Wang 2017-08-17  324  						    group_or_pin, configs,
41d32cfce1ae61 Baolin Wang 2017-08-17  325  						    num_configs, type);
41d32cfce1ae61 Baolin Wang 2017-08-17  326  	}
41d32cfce1ae61 Baolin Wang 2017-08-17  327  
41d32cfce1ae61 Baolin Wang 2017-08-17  328  out:
41d32cfce1ae61 Baolin Wang 2017-08-17  329  	kfree(configs);
41d32cfce1ae61 Baolin Wang 2017-08-17  330  	return ret;
41d32cfce1ae61 Baolin Wang 2017-08-17  331  }
41d32cfce1ae61 Baolin Wang 2017-08-17  332  

:::::: The code at line 282 was first introduced by commit
:::::: 41d32cfce1ae616413761d07986e1fb4b907e808 pinctrl: sprd: Add Spreadtrum pin control driver

:::::: TO: Baolin Wang <[email protected]> :::::: CC: Linus Walleij <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author maintainer
#4 lore raw

Re: [PATCH 2/2] pinctrl: sprd: Allow the SPRD pinctrl driver building into a module

Hi

Quoted 22 lines · kbuild test robot

Hi Baolin,

I love your patch! Yet something to improve:

[auto build test ERROR on pinctrl/devel]
[also build test ERROR on v5.6-rc3 next-20200228]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Baolin-Wang/pinctrl-Export-some-needed-symbols-at-module-load-time/20200227-121948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: i386-randconfig-d003-20200229 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386

If you fix the issue, kindly add following tag

Quoted 8 lines

All errors (new ones prefixed by >>):

drivers/pinctrl/sprd/pinctrl-sprd.c: In function 'sprd_dt_node_to_map':

Quoted 1 line
Quoted 1 line

drivers/pinctrl/sprd/pinctrl-sprd.c:282:8: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Werror=implicit-function-declaration]

ret = pinconf_generic_parse_dt_config(np, pctldev, &configs,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pinconf_generic_dump_config
cc1: some warnings being treated as errors

I followed your attached configuration, but I can not reproduce your building error. Did I miss anything else? Thanks.

CONFIG_PINCTRL=y
CONFIG_PINMUX=y
CONFIG_GENERIC_PINMUX_FUNCTIONS=y
CONFIG_PINCONF=y
CONFIG_GENERIC_PINCONF=y
CONFIG_PINCTRL_SPRD=y
CONFIG_PINCTRL_SPRD_SC9860=y

#5 lore raw

Re: [PATCH 2/2] pinctrl: sprd: Allow the SPRD pinctrl driver building into a module

Quoted 35 lines · Baolin Wang

Hi

Quoted 21 lines · kbuild test robot

Hi Baolin,

I love your patch! Yet something to improve:

[auto build test ERROR on pinctrl/devel]
[also build test ERROR on v5.6-rc3 next-20200228]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Baolin-Wang/pinctrl-Export-some-needed-symbols-at-module-load-time/20200227-121948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: i386-randconfig-d003-20200229 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
         # save the attached .config to linux build tree
         make ARCH=i386

If you fix the issue, kindly add following tag

Quoted 8 lines

All errors (new ones prefixed by >>):

drivers/pinctrl/sprd/pinctrl-sprd.c: In function 'sprd_dt_node_to_map':

Quoted 1 line
Quoted 1 line

drivers/pinctrl/sprd/pinctrl-sprd.c:282:8: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Werror=implicit-function-declaration]

ret = pinconf_generic_parse_dt_config(np, pctldev, &configs,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pinconf_generic_dump_config
cc1: some warnings being treated as errors

I followed your attached configuration, but I can not reproduce your building error. Did I miss anything else? Thanks.

Quoted 8 lines

CONFIG_PINCTRL=y
CONFIG_PINMUX=y
CONFIG_GENERIC_PINMUX_FUNCTIONS=y
CONFIG_PINCONF=y
CONFIG_GENERIC_PINCONF=y
CONFIG_PINCTRL_SPRD=y
CONFIG_PINCTRL_SPRD_SC9860=y

Hi Baolin,

We can reproduce this error with attached config and our branch "https://github.com/0day-ci/linux/commits/Baolin-Wang/pinctrl-Export-some-needed-symbols-at-module-load-time/20200227-121948", could you try again?

Best Regards,
Rong Chen

author maintainer
#6 lore raw

Re: [PATCH 2/2] pinctrl: sprd: Allow the SPRD pinctrl driver building into a module

Hi Rong,

Quoted 48 lines · Rong Chen
Quoted 35 lines · Baolin Wang

Hi

Quoted 21 lines · kbuild test robot

Hi Baolin,

I love your patch! Yet something to improve:

[auto build test ERROR on pinctrl/devel]
[also build test ERROR on v5.6-rc3 next-20200228]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Baolin-Wang/pinctrl-Export-some-needed-symbols-at-module-load-time/20200227-121948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: i386-randconfig-d003-20200229 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
         # save the attached .config to linux build tree
         make ARCH=i386

If you fix the issue, kindly add following tag

Quoted 8 lines

All errors (new ones prefixed by >>):

drivers/pinctrl/sprd/pinctrl-sprd.c: In function 'sprd_dt_node_to_map':

Quoted 1 line
Quoted 1 line

drivers/pinctrl/sprd/pinctrl-sprd.c:282:8: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Werror=implicit-function-declaration]

ret = pinconf_generic_parse_dt_config(np, pctldev, &configs,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pinconf_generic_dump_config
cc1: some warnings being treated as errors

I followed your attached configuration, but I can not reproduce your building error. Did I miss anything else? Thanks.

Quoted 8 lines

CONFIG_PINCTRL=y
CONFIG_PINMUX=y
CONFIG_GENERIC_PINMUX_FUNCTIONS=y
CONFIG_PINCONF=y
CONFIG_GENERIC_PINCONF=y
CONFIG_PINCTRL_SPRD=y
CONFIG_PINCTRL_SPRD_SC9860=y

Quoted 5 lines

Hi Baolin,

We can reproduce this error with attached config and our branch "https://github.com/0day-ci/linux/commits/Baolin-Wang/pinctrl-Export-some-needed-symbols-at-module-load-time/20200227-121948", could you try again?

I can reproduce the warning on X86 platform now, and I've already sent out a patch to fix it. Thanks
https://lkml.org/lkml/2020/3/2/1551

Signature · 1 line
Baolin Wang