lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202210072127.hqV6Bg6r-lkp@intel.com>
Date:   Fri, 7 Oct 2022 21:47:27 +0800
From:   kernel test robot <lkp@...el.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Basavaraj Natikar <Basavaraj.Natikar@....com>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [rft, PATCH v1 1/1] pinctrl: Clean up headers

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linus/master v6.0 next-20221007]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/pinctrl-Clean-up-headers/20221007-183311
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: hexagon-randconfig-r041-20221003
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/5b392edeea764a64953fbab65c9a06b2745ebdd7
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/pinctrl-Clean-up-headers/20221007-183311
        git checkout 5b392edeea764a64953fbab65c9a06b2745ebdd7
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/pinctrl/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All error/warnings (new ones prefixed by >>):

>> drivers/pinctrl/pinmux.c:34:46: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *ops = pctldev->desc->pmxops;
                                          ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:87:46: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *ops = pctldev->desc->pmxops;
                                          ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:113:46: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *ops = pctldev->desc->pmxops;
                                          ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:210:46: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *ops = pctldev->desc->pmxops;
                                          ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
>> drivers/pinctrl/pinmux.c:270:46: error: incomplete definition of type 'struct pinctrl_gpio_range'
           owner = kasprintf(GFP_KERNEL, "%s:%d", range->name, gpio);
                                                  ~~~~~^
   include/linux/pinctrl/pinmux.h:17:8: note: forward declaration of 'struct pinctrl_gpio_range'
   struct pinctrl_gpio_range;
          ^
   drivers/pinctrl/pinmux.c:310:21: error: incomplete definition of type 'struct pinctrl_desc'
           ops = pctldev->desc->pmxops;
                 ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:323:46: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *ops = pctldev->desc->pmxops;
                                          ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:344:49: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
                                             ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:408:51: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                                               ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:409:46: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinmux_ops *ops = pctldev->desc->pmxops;
                                          ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
>> drivers/pinctrl/pinmux.c:416:13: error: incomplete definition of type 'struct pinctrl_ops'
           if (pctlops->get_group_pins)
               ~~~~~~~^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   drivers/pinctrl/pinmux.c:408:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
>> drivers/pinctrl/pinmux.c:416:13: error: incomplete definition of type 'struct pinctrl_ops'
           if (pctlops->get_group_pins)
               ~~~~~~~^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                               ^~~~
   drivers/pinctrl/pinmux.c:408:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
>> drivers/pinctrl/pinmux.c:416:13: error: incomplete definition of type 'struct pinctrl_ops'
           if (pctlops->get_group_pins)
               ~~~~~~~^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/pinctrl/pinmux.c:408:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
   drivers/pinctrl/pinmux.c:417:16: error: incomplete definition of type 'struct pinctrl_ops'
                   ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
                         ~~~~~~~^
   drivers/pinctrl/pinmux.c:408:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
   drivers/pinctrl/pinmux.c:424:18: error: incomplete definition of type 'struct pinctrl_ops'
                   gname = pctlops->get_group_name(pctldev,
                           ~~~~~~~^
   drivers/pinctrl/pinmux.c:408:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
   drivers/pinctrl/pinmux.c:441:19: error: incomplete definition of type 'struct pinctrl_ops'
                           gname = pctlops->get_group_name(pctldev,
                                   ~~~~~~~^
   drivers/pinctrl/pinmux.c:408:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
>> drivers/pinctrl/pinmux.c:447:5: error: call to undeclared function 'pinctrl_dev_get_name'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                   pinctrl_dev_get_name(pctldev));
                                   ^
>> drivers/pinctrl/pinmux.c:447:5: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
                                   pinctrl_dev_get_name(pctldev));
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
           dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                  ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                ~~~    ^~~~~~~~~~~
   drivers/pinctrl/pinmux.c:489:51: error: incomplete definition of type 'struct pinctrl_desc'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                                               ~~~~~~~~~~~~~^
   drivers/pinctrl/core.h:44:9: note: forward declaration of 'struct pinctrl_desc'
           struct pinctrl_desc *desc;
                  ^
   drivers/pinctrl/pinmux.c:496:13: error: incomplete definition of type 'struct pinctrl_ops'
           if (pctlops->get_group_pins)
               ~~~~~~~^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   drivers/pinctrl/pinmux.c:489:15: note: forward declaration of 'struct pinctrl_ops'
           const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
                        ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.


vim +270 drivers/pinctrl/pinmux.c

2744e8afb3b763 Linus Walleij    2011-05-02  254  
2744e8afb3b763 Linus Walleij    2011-05-02  255  /**
befe5bdfbb698b Linus Walleij    2012-02-09  256   * pinmux_request_gpio() - request pinmuxing for a GPIO pin
befe5bdfbb698b Linus Walleij    2012-02-09  257   * @pctldev: pin controller device affected
befe5bdfbb698b Linus Walleij    2012-02-09  258   * @pin: the pin to mux in for GPIO
befe5bdfbb698b Linus Walleij    2012-02-09  259   * @range: the applicable GPIO range
d340351f8168d2 Lee Jones        2020-07-13  260   * @gpio: number of requested GPIO
2744e8afb3b763 Linus Walleij    2011-05-02  261   */
befe5bdfbb698b Linus Walleij    2012-02-09  262  int pinmux_request_gpio(struct pinctrl_dev *pctldev,
befe5bdfbb698b Linus Walleij    2012-02-09  263  			struct pinctrl_gpio_range *range,
befe5bdfbb698b Linus Walleij    2012-02-09  264  			unsigned pin, unsigned gpio)
2744e8afb3b763 Linus Walleij    2011-05-02  265  {
3cc70ed32cd6c5 Stephen Warren   2012-02-19  266  	const char *owner;
2744e8afb3b763 Linus Walleij    2011-05-02  267  	int ret;
2744e8afb3b763 Linus Walleij    2011-05-02  268  
2744e8afb3b763 Linus Walleij    2011-05-02  269  	/* Conjure some name stating what chip and pin this is taken by */
23a895aee6081c Thomas Petazzoni 2012-09-13 @270  	owner = kasprintf(GFP_KERNEL, "%s:%d", range->name, gpio);
3cc70ed32cd6c5 Stephen Warren   2012-02-19  271  	if (!owner)
1fb1f0540deae6 Masahiro Yamada  2016-05-25  272  		return -ENOMEM;
5d2eaf8090874f Stephen Warren   2011-10-19  273  
3cc70ed32cd6c5 Stephen Warren   2012-02-19  274  	ret = pin_request(pctldev, pin, owner, range);
5d2eaf8090874f Stephen Warren   2011-10-19  275  	if (ret < 0)
3cc70ed32cd6c5 Stephen Warren   2012-02-19  276  		kfree(owner);
5d2eaf8090874f Stephen Warren   2011-10-19  277  
5d2eaf8090874f Stephen Warren   2011-10-19  278  	return ret;
2744e8afb3b763 Linus Walleij    2011-05-02  279  }
2744e8afb3b763 Linus Walleij    2011-05-02  280  
2744e8afb3b763 Linus Walleij    2011-05-02  281  /**
befe5bdfbb698b Linus Walleij    2012-02-09  282   * pinmux_free_gpio() - release a pin from GPIO muxing
befe5bdfbb698b Linus Walleij    2012-02-09  283   * @pctldev: the pin controller device for the pin
befe5bdfbb698b Linus Walleij    2012-02-09  284   * @pin: the affected currently GPIO-muxed in pin
befe5bdfbb698b Linus Walleij    2012-02-09  285   * @range: applicable GPIO range
2744e8afb3b763 Linus Walleij    2011-05-02  286   */
befe5bdfbb698b Linus Walleij    2012-02-09  287  void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
befe5bdfbb698b Linus Walleij    2012-02-09  288  		      struct pinctrl_gpio_range *range)
2744e8afb3b763 Linus Walleij    2011-05-02  289  {
3cc70ed32cd6c5 Stephen Warren   2012-02-19  290  	const char *owner;
2744e8afb3b763 Linus Walleij    2011-05-02  291  
3cc70ed32cd6c5 Stephen Warren   2012-02-19  292  	owner = pin_free(pctldev, pin, range);
3cc70ed32cd6c5 Stephen Warren   2012-02-19  293  	kfree(owner);
2744e8afb3b763 Linus Walleij    2011-05-02  294  }
2744e8afb3b763 Linus Walleij    2011-05-02  295  
befe5bdfbb698b Linus Walleij    2012-02-09  296  /**
befe5bdfbb698b Linus Walleij    2012-02-09  297   * pinmux_gpio_direction() - set the direction of a single muxed-in GPIO pin
befe5bdfbb698b Linus Walleij    2012-02-09  298   * @pctldev: the pin controller handling this pin
befe5bdfbb698b Linus Walleij    2012-02-09  299   * @range: applicable GPIO range
befe5bdfbb698b Linus Walleij    2012-02-09  300   * @pin: the affected GPIO pin in this controller
befe5bdfbb698b Linus Walleij    2012-02-09  301   * @input: true if we set the pin as input, false for output
befe5bdfbb698b Linus Walleij    2012-02-09  302   */
befe5bdfbb698b Linus Walleij    2012-02-09  303  int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
befe5bdfbb698b Linus Walleij    2012-02-09  304  			  struct pinctrl_gpio_range *range,
befe5bdfbb698b Linus Walleij    2012-02-09  305  			  unsigned pin, bool input)
542e704f3ffee1 Linus Walleij    2011-11-14  306  {
542e704f3ffee1 Linus Walleij    2011-11-14  307  	const struct pinmux_ops *ops;
542e704f3ffee1 Linus Walleij    2011-11-14  308  	int ret;
542e704f3ffee1 Linus Walleij    2011-11-14  309  
542e704f3ffee1 Linus Walleij    2011-11-14  310  	ops = pctldev->desc->pmxops;
542e704f3ffee1 Linus Walleij    2011-11-14  311  
542e704f3ffee1 Linus Walleij    2011-11-14  312  	if (ops->gpio_set_direction)
542e704f3ffee1 Linus Walleij    2011-11-14  313  		ret = ops->gpio_set_direction(pctldev, range, pin, input);
542e704f3ffee1 Linus Walleij    2011-11-14  314  	else
542e704f3ffee1 Linus Walleij    2011-11-14  315  		ret = 0;
542e704f3ffee1 Linus Walleij    2011-11-14  316  
542e704f3ffee1 Linus Walleij    2011-11-14  317  	return ret;
542e704f3ffee1 Linus Walleij    2011-11-14  318  }
542e704f3ffee1 Linus Walleij    2011-11-14  319  
7ecdb16fe63e5b Stephen Warren   2012-03-02  320  static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
7ecdb16fe63e5b Stephen Warren   2012-03-02  321  					const char *function)
2744e8afb3b763 Linus Walleij    2011-05-02  322  {
7ecdb16fe63e5b Stephen Warren   2012-03-02  323  	const struct pinmux_ops *ops = pctldev->desc->pmxops;
d1e90e9e7467db Viresh Kumar     2012-03-30  324  	unsigned nfuncs = ops->get_functions_count(pctldev);
7ecdb16fe63e5b Stephen Warren   2012-03-02  325  	unsigned selector = 0;
2744e8afb3b763 Linus Walleij    2011-05-02  326  
7ecdb16fe63e5b Stephen Warren   2012-03-02  327  	/* See if this pctldev has this function */
d1e90e9e7467db Viresh Kumar     2012-03-30  328  	while (selector < nfuncs) {
163dc9f39a26b4 Masahiro Yamada  2015-08-01  329  		const char *fname = ops->get_function_name(pctldev, selector);
2744e8afb3b763 Linus Walleij    2011-05-02  330  
7ecdb16fe63e5b Stephen Warren   2012-03-02  331  		if (!strcmp(function, fname))
7ecdb16fe63e5b Stephen Warren   2012-03-02  332  			return selector;
2744e8afb3b763 Linus Walleij    2011-05-02  333  
7ecdb16fe63e5b Stephen Warren   2012-03-02  334  		selector++;
2744e8afb3b763 Linus Walleij    2011-05-02  335  	}
2744e8afb3b763 Linus Walleij    2011-05-02  336  
7ecdb16fe63e5b Stephen Warren   2012-03-02  337  	return -EINVAL;
2744e8afb3b763 Linus Walleij    2011-05-02  338  }
2744e8afb3b763 Linus Walleij    2011-05-02  339  
3f713b7c223ebe Masahiro Yamada  2017-08-04  340  int pinmux_map_to_setting(const struct pinctrl_map *map,
7ecdb16fe63e5b Stephen Warren   2012-03-02  341  			  struct pinctrl_setting *setting)
2744e8afb3b763 Linus Walleij    2011-05-02  342  {
7ecdb16fe63e5b Stephen Warren   2012-03-02  343  	struct pinctrl_dev *pctldev = setting->pctldev;
2744e8afb3b763 Linus Walleij    2011-05-02  344  	const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
2744e8afb3b763 Linus Walleij    2011-05-02  345  	char const * const *groups;
2744e8afb3b763 Linus Walleij    2011-05-02  346  	unsigned num_groups;
2744e8afb3b763 Linus Walleij    2011-05-02  347  	int ret;
7ecdb16fe63e5b Stephen Warren   2012-03-02  348  	const char *group;
2744e8afb3b763 Linus Walleij    2011-05-02  349  
ad8bb720c23a80 Dong Aisheng     2012-04-10  350  	if (!pmxops) {
ad8bb720c23a80 Dong Aisheng     2012-04-10  351  		dev_err(pctldev->dev, "does not support mux function\n");
ad8bb720c23a80 Dong Aisheng     2012-04-10  352  		return -EINVAL;
ad8bb720c23a80 Dong Aisheng     2012-04-10  353  	}
ad8bb720c23a80 Dong Aisheng     2012-04-10  354  
15f70e1b9a1a63 John Crispin     2012-04-23  355  	ret = pinmux_func_name_to_selector(pctldev, map->data.mux.function);
ad6e1107baa2e7 John Crispin     2012-04-26  356  	if (ret < 0) {
ad6e1107baa2e7 John Crispin     2012-04-26  357  		dev_err(pctldev->dev, "invalid function %s in map table\n",
ad6e1107baa2e7 John Crispin     2012-04-26  358  			map->data.mux.function);
15f70e1b9a1a63 John Crispin     2012-04-23  359  		return ret;
ad6e1107baa2e7 John Crispin     2012-04-26  360  	}
15f70e1b9a1a63 John Crispin     2012-04-23  361  	setting->data.mux.func = ret;
7ecdb16fe63e5b Stephen Warren   2012-03-02  362  
1e2082b5207217 Stephen Warren   2012-03-02  363  	ret = pmxops->get_function_groups(pctldev, setting->data.mux.func,
7ecdb16fe63e5b Stephen Warren   2012-03-02  364  					  &groups, &num_groups);
ad6e1107baa2e7 John Crispin     2012-04-26  365  	if (ret < 0) {
ad6e1107baa2e7 John Crispin     2012-04-26  366  		dev_err(pctldev->dev, "can't query groups for function %s\n",
ad6e1107baa2e7 John Crispin     2012-04-26  367  			map->data.mux.function);
2744e8afb3b763 Linus Walleij    2011-05-02  368  		return ret;
ad6e1107baa2e7 John Crispin     2012-04-26  369  	}
ad6e1107baa2e7 John Crispin     2012-04-26  370  	if (!num_groups) {
ad6e1107baa2e7 John Crispin     2012-04-26  371  		dev_err(pctldev->dev,
ad6e1107baa2e7 John Crispin     2012-04-26  372  			"function %s can't be selected on any group\n",
ad6e1107baa2e7 John Crispin     2012-04-26  373  			map->data.mux.function);
7ecdb16fe63e5b Stephen Warren   2012-03-02  374  		return -EINVAL;
ad6e1107baa2e7 John Crispin     2012-04-26  375  	}
1e2082b5207217 Stephen Warren   2012-03-02  376  	if (map->data.mux.group) {
1e2082b5207217 Stephen Warren   2012-03-02  377  		group = map->data.mux.group;
dff43594481269 Andy Shevchenko  2016-03-17  378  		ret = match_string(groups, num_groups, group);
dff43594481269 Andy Shevchenko  2016-03-17  379  		if (ret < 0) {
ad6e1107baa2e7 John Crispin     2012-04-26  380  			dev_err(pctldev->dev,
ad6e1107baa2e7 John Crispin     2012-04-26  381  				"invalid group \"%s\" for function \"%s\"\n",
ad6e1107baa2e7 John Crispin     2012-04-26  382  				group, map->data.mux.function);
dff43594481269 Andy Shevchenko  2016-03-17  383  			return ret;
ad6e1107baa2e7 John Crispin     2012-04-26  384  		}
7ecdb16fe63e5b Stephen Warren   2012-03-02  385  	} else {
7ecdb16fe63e5b Stephen Warren   2012-03-02  386  		group = groups[0];
2744e8afb3b763 Linus Walleij    2011-05-02  387  	}
2744e8afb3b763 Linus Walleij    2011-05-02  388  
15f70e1b9a1a63 John Crispin     2012-04-23  389  	ret = pinctrl_get_group_selector(pctldev, group);
ad6e1107baa2e7 John Crispin     2012-04-26  390  	if (ret < 0) {
ad6e1107baa2e7 John Crispin     2012-04-26  391  		dev_err(pctldev->dev, "invalid group %s in map table\n",
ad6e1107baa2e7 John Crispin     2012-04-26  392  			map->data.mux.group);
15f70e1b9a1a63 John Crispin     2012-04-23  393  		return ret;
ad6e1107baa2e7 John Crispin     2012-04-26  394  	}
15f70e1b9a1a63 John Crispin     2012-04-23  395  	setting->data.mux.group = ret;
2744e8afb3b763 Linus Walleij    2011-05-02  396  
2744e8afb3b763 Linus Walleij    2011-05-02  397  	return 0;
2744e8afb3b763 Linus Walleij    2011-05-02  398  }
2744e8afb3b763 Linus Walleij    2011-05-02  399  
3f713b7c223ebe Masahiro Yamada  2017-08-04  400  void pinmux_free_setting(const struct pinctrl_setting *setting)
2744e8afb3b763 Linus Walleij    2011-05-02  401  {
1a78958dc212f3 Linus Walleij    2012-10-17  402  	/* This function is currently unused */
2744e8afb3b763 Linus Walleij    2011-05-02  403  }
2744e8afb3b763 Linus Walleij    2011-05-02  404  
3f713b7c223ebe Masahiro Yamada  2017-08-04  405  int pinmux_enable_setting(const struct pinctrl_setting *setting)
2744e8afb3b763 Linus Walleij    2011-05-02  406  {
7ecdb16fe63e5b Stephen Warren   2012-03-02  407  	struct pinctrl_dev *pctldev = setting->pctldev;
ba110d90c08d96 Stephen Warren   2012-03-02  408  	const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
2744e8afb3b763 Linus Walleij    2011-05-02  409  	const struct pinmux_ops *ops = pctldev->desc->pmxops;
e5b3b2d9ed2026 Antoine Tenart   2014-04-10  410  	int ret = 0;
e5b3b2d9ed2026 Antoine Tenart   2014-04-10  411  	const unsigned *pins = NULL;
e5b3b2d9ed2026 Antoine Tenart   2014-04-10  412  	unsigned num_pins = 0;
ba110d90c08d96 Stephen Warren   2012-03-02  413  	int i;
ba110d90c08d96 Stephen Warren   2012-03-02  414  	struct pin_desc *desc;
ba110d90c08d96 Stephen Warren   2012-03-02  415  
e5b3b2d9ed2026 Antoine Tenart   2014-04-10 @416  	if (pctlops->get_group_pins)
ba110d90c08d96 Stephen Warren   2012-03-02  417  		ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
ba110d90c08d96 Stephen Warren   2012-03-02  418  					      &pins, &num_pins);
e5b3b2d9ed2026 Antoine Tenart   2014-04-10  419  
ba110d90c08d96 Stephen Warren   2012-03-02  420  	if (ret) {
1c8e794432c2ee Linus Walleij    2013-08-14  421  		const char *gname;
1c8e794432c2ee Linus Walleij    2013-08-14  422  
ba110d90c08d96 Stephen Warren   2012-03-02  423  		/* errors only affect debug data, so just warn */
1c8e794432c2ee Linus Walleij    2013-08-14  424  		gname = pctlops->get_group_name(pctldev,
ba110d90c08d96 Stephen Warren   2012-03-02  425  						setting->data.mux.group);
1c8e794432c2ee Linus Walleij    2013-08-14  426  		dev_warn(pctldev->dev,
1c8e794432c2ee Linus Walleij    2013-08-14  427  			 "could not get pins for group %s\n",
1c8e794432c2ee Linus Walleij    2013-08-14  428  			 gname);
ba110d90c08d96 Stephen Warren   2012-03-02  429  		num_pins = 0;
ba110d90c08d96 Stephen Warren   2012-03-02  430  	}
ba110d90c08d96 Stephen Warren   2012-03-02  431  
1a78958dc212f3 Linus Walleij    2012-10-17  432  	/* Try to allocate all pins in this group, one by one */
1a78958dc212f3 Linus Walleij    2012-10-17  433  	for (i = 0; i < num_pins; i++) {
1a78958dc212f3 Linus Walleij    2012-10-17  434  		ret = pin_request(pctldev, pins[i], setting->dev_name, NULL);
1a78958dc212f3 Linus Walleij    2012-10-17  435  		if (ret) {
1c8e794432c2ee Linus Walleij    2013-08-14  436  			const char *gname;
1c8e794432c2ee Linus Walleij    2013-08-14  437  			const char *pname;
1c8e794432c2ee Linus Walleij    2013-08-14  438  
1c8e794432c2ee Linus Walleij    2013-08-14  439  			desc = pin_desc_get(pctldev, pins[i]);
1c8e794432c2ee Linus Walleij    2013-08-14  440  			pname = desc ? desc->name : "non-existing";
1c8e794432c2ee Linus Walleij    2013-08-14  441  			gname = pctlops->get_group_name(pctldev,
1c8e794432c2ee Linus Walleij    2013-08-14  442  						setting->data.mux.group);
1a78958dc212f3 Linus Walleij    2012-10-17  443  			dev_err(pctldev->dev,
1c8e794432c2ee Linus Walleij    2013-08-14  444  				"could not request pin %d (%s) from group %s "
1c8e794432c2ee Linus Walleij    2013-08-14  445  				" on device %s\n",
1c8e794432c2ee Linus Walleij    2013-08-14  446  				pins[i], pname, gname,
1c8e794432c2ee Linus Walleij    2013-08-14 @447  				pinctrl_dev_get_name(pctldev));
e38d457de7be63 Axel Lin         2012-11-10  448  			goto err_pin_request;
1a78958dc212f3 Linus Walleij    2012-10-17  449  		}
1a78958dc212f3 Linus Walleij    2012-10-17  450  	}
1a78958dc212f3 Linus Walleij    2012-10-17  451  
1a78958dc212f3 Linus Walleij    2012-10-17  452  	/* Now that we have acquired the pins, encode the mux setting */
ba110d90c08d96 Stephen Warren   2012-03-02  453  	for (i = 0; i < num_pins; i++) {
ba110d90c08d96 Stephen Warren   2012-03-02  454  		desc = pin_desc_get(pctldev, pins[i]);
ba110d90c08d96 Stephen Warren   2012-03-02  455  		if (desc == NULL) {
ba110d90c08d96 Stephen Warren   2012-03-02  456  			dev_warn(pctldev->dev,
ba110d90c08d96 Stephen Warren   2012-03-02  457  				 "could not get pin desc for pin %d\n",
ba110d90c08d96 Stephen Warren   2012-03-02  458  				 pins[i]);
ba110d90c08d96 Stephen Warren   2012-03-02  459  			continue;
ba110d90c08d96 Stephen Warren   2012-03-02  460  		}
ba110d90c08d96 Stephen Warren   2012-03-02  461  		desc->mux_setting = &(setting->data.mux);
ba110d90c08d96 Stephen Warren   2012-03-02  462  	}
2744e8afb3b763 Linus Walleij    2011-05-02  463  
03e9f0cac5da6a Linus Walleij    2014-09-03  464  	ret = ops->set_mux(pctldev, setting->data.mux.func,
1e2082b5207217 Stephen Warren   2012-03-02  465  			   setting->data.mux.group);
e38d457de7be63 Axel Lin         2012-11-10  466  
e38d457de7be63 Axel Lin         2012-11-10  467  	if (ret)
03e9f0cac5da6a Linus Walleij    2014-09-03  468  		goto err_set_mux;
e38d457de7be63 Axel Lin         2012-11-10  469  
e38d457de7be63 Axel Lin         2012-11-10  470  	return 0;
e38d457de7be63 Axel Lin         2012-11-10  471  
03e9f0cac5da6a Linus Walleij    2014-09-03  472  err_set_mux:
e38d457de7be63 Axel Lin         2012-11-10  473  	for (i = 0; i < num_pins; i++) {
e38d457de7be63 Axel Lin         2012-11-10  474  		desc = pin_desc_get(pctldev, pins[i]);
e38d457de7be63 Axel Lin         2012-11-10  475  		if (desc)
e38d457de7be63 Axel Lin         2012-11-10  476  			desc->mux_setting = NULL;
e38d457de7be63 Axel Lin         2012-11-10  477  	}
e38d457de7be63 Axel Lin         2012-11-10  478  err_pin_request:
e38d457de7be63 Axel Lin         2012-11-10  479  	/* On error release all taken pins */
e38d457de7be63 Axel Lin         2012-11-10  480  	while (--i >= 0)
e38d457de7be63 Axel Lin         2012-11-10  481  		pin_free(pctldev, pins[i], NULL);
e38d457de7be63 Axel Lin         2012-11-10  482  
e38d457de7be63 Axel Lin         2012-11-10  483  	return ret;
befe5bdfbb698b Linus Walleij    2012-02-09  484  }
2744e8afb3b763 Linus Walleij    2011-05-02  485  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (112716 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ