diff mbox series

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

Message ID d7239f3c7379e402f665fc8927f635ac56691380.1582776447.git.baolin.wang7@gmail.com
State New
Headers show
Series [1/2] pinctrl: Export some needed symbols at module load time | expand

Commit Message

Baolin Wang Feb. 27, 2020, 4:13 a.m. UTC
Change the config to 'tristate' and export some symbols needed by modules
to allow the Spreadtrum pinctrl driver building into a module.

Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
---
 drivers/pinctrl/sprd/Kconfig        | 6 +++---
 drivers/pinctrl/sprd/pinctrl-sprd.c | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Linus Walleij Feb. 28, 2020, 11:26 p.m. UTC | #1
On Thu, Feb 27, 2020 at 5:14 AM Baolin Wang <baolin.wang7@gmail.com> wrote:

> Change the config to 'tristate' and export some symbols needed by modules
> to allow the Spreadtrum pinctrl driver building into a module.
>
> Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>

Patch applied.

Yours,
Linus Walleij
kernel test robot Feb. 29, 2020, 12:41 a.m. UTC | #2
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
Reported-by: kbuild test robot <lkp@intel.com>

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 <baolin.wang@spreadtrum.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Baolin Wang March 2, 2020, 2:33 a.m. UTC | #3
Hi

On Sat, Feb 29, 2020 at 8:41 AM kbuild test robot <lkp@intel.com> wrote:
>
> 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
> Reported-by: kbuild test robot <lkp@intel.com>
>
> 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

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
Chen, Rong A March 3, 2020, 6:42 a.m. UTC | #4
On 3/2/20 10:33 AM, Baolin Wang wrote:
> Hi
>
> On Sat, Feb 29, 2020 at 8:41 AM kbuild test robot <lkp@intel.com> wrote:
>> 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
>> Reported-by: kbuild test robot <lkp@intel.com>
>>
>> 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
> 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
>

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
Baolin Wang March 3, 2020, 6:48 a.m. UTC | #5
Hi Rong,

On Tue, Mar 3, 2020 at 2:43 PM Rong Chen <rong.a.chen@intel.com> wrote:
>
>
>
> On 3/2/20 10:33 AM, Baolin Wang wrote:
> > Hi
> >
> > On Sat, Feb 29, 2020 at 8:41 AM kbuild test robot <lkp@intel.com> wrote:
> >> 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
> >> Reported-by: kbuild test robot <lkp@intel.com>
> >>
> >> 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
> > 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
> >
>
> 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
diff mbox series

Patch

diff --git a/drivers/pinctrl/sprd/Kconfig b/drivers/pinctrl/sprd/Kconfig
index b6c5479..c9e7f0b 100644
--- a/drivers/pinctrl/sprd/Kconfig
+++ b/drivers/pinctrl/sprd/Kconfig
@@ -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
diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
index 157712ab..ea04bac 100644
--- a/drivers/pinctrl/sprd/pinctrl-sprd.c
+++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
@@ -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 <baolin.wang@spreadtrum.com>");