2021-12-15 17:48:32

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH] pinctrl: add one more "const" for generic function groups

From: Rafał Miłecki <[email protected]>

Generic code doesn't modify those strings and .get_function_groups
callback has that extra "const" as well. This allows more flexibility in
GENERIC_PINMUX_FUNCTIONS users.

Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/pinctrl/pinmux.c | 2 +-
drivers/pinctrl/pinmux.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 6cdbd9ccf2f0..f94d43b082d9 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -875,7 +875,7 @@ EXPORT_SYMBOL_GPL(pinmux_generic_get_function);
*/
int pinmux_generic_add_function(struct pinctrl_dev *pctldev,
const char *name,
- const char **groups,
+ const char * const *groups,
const unsigned int num_groups,
void *data)
{
diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h
index 78c3a31be882..72fcf03eaa43 100644
--- a/drivers/pinctrl/pinmux.h
+++ b/drivers/pinctrl/pinmux.h
@@ -129,7 +129,7 @@ static inline void pinmux_init_device_debugfs(struct dentry *devroot,
*/
struct function_desc {
const char *name;
- const char **group_names;
+ const char * const *group_names;
int num_group_names;
void *data;
};
@@ -150,7 +150,7 @@ struct function_desc *pinmux_generic_get_function(struct pinctrl_dev *pctldev,

int pinmux_generic_add_function(struct pinctrl_dev *pctldev,
const char *name,
- const char **groups,
+ const char * const *groups,
unsigned const num_groups,
void *data);

--
2.31.1



2021-12-15 23:18:30

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: add one more "const" for generic function groups

Hi "Rafał,

I love your patch! Yet something to improve:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on v5.16-rc5 next-20211214]
[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]

url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/pinctrl-add-one-more-const-for-generic-function-groups/20211216-014859
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: arm-randconfig-c002-20211214 (https://download.01.org/0day-ci/archive/20211216/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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/0day-ci/linux/commit/e4338a6ad34998afb60c5ad294aafa06cd7110a7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafa-Mi-ecki/pinctrl-add-one-more-const-for-generic-function-groups/20211216-014859
git checkout e4338a6ad34998afb60c5ad294aafa06cd7110a7
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/pinctrl/freescale/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/pinctrl/freescale/pinctrl-imx.c: In function 'imx_pinctrl_parse_functions':
>> drivers/pinctrl/freescale/pinctrl-imx.c:672:38: error: assignment of read-only location '*(func->group_names + (sizetype)(i * 4))'
672 | func->group_names[i] = child->name;
| ^


vim +672 drivers/pinctrl/freescale/pinctrl-imx.c

ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 642
150632b09aadf1 drivers/pinctrl/pinctrl-imx.c Greg Kroah-Hartman 2012-12-21 643 static int imx_pinctrl_parse_functions(struct device_node *np,
e566fc11ea76ec drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 644 struct imx_pinctrl *ipctl,
150632b09aadf1 drivers/pinctrl/pinctrl-imx.c Greg Kroah-Hartman 2012-12-21 645 u32 index)
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 646 {
e566fc11ea76ec drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 647 struct pinctrl_dev *pctl = ipctl->pctl;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 648 struct device_node *child;
3fd6d6ad73af90 drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 649 struct function_desc *func;
e566fc11ea76ec drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 650 struct group_desc *grp;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 651 u32 i = 0;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 652
94f4e54cecaf3e drivers/pinctrl/freescale/pinctrl-imx.c Rob Herring 2018-08-27 653 dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np);
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 654
3fd6d6ad73af90 drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 655 func = pinmux_generic_get_function(pctl, index);
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 656 if (!func)
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 657 return -EINVAL;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 658
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 659 /* Initialise function */
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 660 func->name = np->name;
3fd6d6ad73af90 drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 661 func->num_group_names = of_get_child_count(np);
3fd6d6ad73af90 drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 662 if (func->num_group_names == 0) {
f5843492ecefcf drivers/pinctrl/freescale/pinctrl-imx.c Stefan Agner 2018-01-06 663 dev_err(ipctl->dev, "no groups defined in %pOF\n", np);
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 664 return -EINVAL;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 665 }
f5843492ecefcf drivers/pinctrl/freescale/pinctrl-imx.c Stefan Agner 2018-01-06 666 func->group_names = devm_kcalloc(ipctl->dev, func->num_group_names,
3fd6d6ad73af90 drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 667 sizeof(char *), GFP_KERNEL);
49af64e6b52208 drivers/pinctrl/freescale/pinctrl-imx.c Christophe JAILLET 2017-05-06 668 if (!func->group_names)
49af64e6b52208 drivers/pinctrl/freescale/pinctrl-imx.c Christophe JAILLET 2017-05-06 669 return -ENOMEM;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 670
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 671 for_each_child_of_node(np, child) {
3fd6d6ad73af90 drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 @672 func->group_names[i] = child->name;
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 673
f5843492ecefcf drivers/pinctrl/freescale/pinctrl-imx.c Stefan Agner 2018-01-06 674 grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc),
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 675 GFP_KERNEL);
bf4b87b0d06aa3 drivers/pinctrl/freescale/pinctrl-imx.c Nishka Dasgupta 2019-08-08 676 if (!grp) {
bf4b87b0d06aa3 drivers/pinctrl/freescale/pinctrl-imx.c Nishka Dasgupta 2019-08-08 677 of_node_put(child);
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 678 return -ENOMEM;
bf4b87b0d06aa3 drivers/pinctrl/freescale/pinctrl-imx.c Nishka Dasgupta 2019-08-08 679 }
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 680
f5843492ecefcf drivers/pinctrl/freescale/pinctrl-imx.c Stefan Agner 2018-01-06 681 mutex_lock(&ipctl->mutex);
e566fc11ea76ec drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2017-01-02 682 radix_tree_insert(&pctl->pin_group_tree,
f5843492ecefcf drivers/pinctrl/freescale/pinctrl-imx.c Stefan Agner 2018-01-06 683 ipctl->group_index++, grp);
f5843492ecefcf drivers/pinctrl/freescale/pinctrl-imx.c Stefan Agner 2018-01-06 684 mutex_unlock(&ipctl->mutex);
a51c158bf0f7ca drivers/pinctrl/freescale/pinctrl-imx.c Gary Bisson 2016-12-02 685
a5cadbbb081cb8 drivers/pinctrl/freescale/pinctrl-imx.c Dong Aisheng 2017-05-19 686 imx_pinctrl_parse_groups(child, grp, ipctl, i++);
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 687 }
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 688
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 689 return 0;
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 690 }
ae75ff81453840 drivers/pinctrl/pinctrl-imx.c Dong Aisheng 2012-04-27 691

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

2021-12-16 01:00:32

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: add one more "const" for generic function groups

Hi "Rafał,

I love your patch! Yet something to improve:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on v5.16-rc5 next-20211214]
[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]

url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/pinctrl-add-one-more-const-for-generic-function-groups/20211216-014859
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: arm64-randconfig-r031-20211215 (https://download.01.org/0day-ci/archive/20211216/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/e4338a6ad34998afb60c5ad294aafa06cd7110a7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafa-Mi-ecki/pinctrl-add-one-more-const-for-generic-function-groups/20211216-014859
git checkout e4338a6ad34998afb60c5ad294aafa06cd7110a7
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/pinctrl/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/pinctrl/pinctrl-keembay.c:1594:8: error: assigning to 'const char **' from 'const char *const *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
grp = func->group_names;
^ ~~~~~~~~~~~~~~~~~
1 error generated.
--
>> drivers/pinctrl/freescale/pinctrl-imx.c:672:24: error: read-only variable is not assignable
func->group_names[i] = child->name;
~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.


vim +1594 drivers/pinctrl/pinctrl-keembay.c

ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1556
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1557 static int keembay_add_functions(struct keembay_pinctrl *kpc,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1558 struct function_desc *function)
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1559 {
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1560 unsigned int i;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1561
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1562 /* Assign the groups for each function */
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1563 for (i = 0; i < kpc->npins; i++) {
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1564 const struct pinctrl_pin_desc *pdesc = keembay_pins + i;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1565 struct keembay_mux_desc *mux = pdesc->drv_data;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1566
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1567 while (mux->name) {
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1568 struct function_desc *func;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1569 const char **grp;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1570 size_t grp_size;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1571 u32 j, grp_num;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1572
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1573 for (j = 0; j < kpc->nfuncs; j++) {
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1574 if (!strcmp(mux->name, function[j].name))
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1575 break;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1576 }
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1577
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1578 if (j == kpc->nfuncs)
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1579 return -EINVAL;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1580
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1581 func = function + j;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1582 grp_num = func->num_group_names;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1583 grp_size = sizeof(*func->group_names);
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1584
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1585 if (!func->group_names) {
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1586 func->group_names = devm_kcalloc(kpc->dev,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1587 grp_num,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1588 grp_size,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1589 GFP_KERNEL);
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1590 if (!func->group_names)
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1591 return -ENOMEM;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1592 }
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1593
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 @1594 grp = func->group_names;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1595 while (*grp)
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1596 grp++;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1597
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1598 *grp = pdesc->name;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1599 mux++;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1600 }
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1601 }
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1602
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1603 /* Add all functions */
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1604 for (i = 0; i < kpc->nfuncs; i++) {
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1605 pinmux_generic_add_function(kpc->pctrl,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1606 function[i].name,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1607 function[i].group_names,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1608 function[i].num_group_names,
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1609 function[i].data);
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1610 }
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1611
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1612 return 0;
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1613 }
ffd4e739358be0 Lakshmi Sowjanya D 2021-08-06 1614

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

2021-12-16 03:07:26

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: add one more "const" for generic function groups

On Wed, Dec 15, 2021 at 6:48 PM Rafał Miłecki <[email protected]> wrote:

> From: Rafał Miłecki <[email protected]>
>
> Generic code doesn't modify those strings and .get_function_groups
> callback has that extra "const" as well. This allows more flexibility in
> GENERIC_PINMUX_FUNCTIONS users.
>
> Signed-off-by: Rafał Miłecki <[email protected]>

I really like const-correctness and I'm a fan of this patch.

It seems some users need to be modified as well though,
the test robot is unhappy.

Yours,
Linus Walleij

2021-12-17 04:04:45

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: add one more "const" for generic function groups

Hi "Rafał,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on v5.16-rc5 next-20211215]
[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]

url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/pinctrl-add-one-more-const-for-generic-function-groups/20211216-014859
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: arm64-randconfig-s031-20211216 (https://download.01.org/0day-ci/archive/20211217/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/e4338a6ad34998afb60c5ad294aafa06cd7110a7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafa-Mi-ecki/pinctrl-add-one-more-const-for-generic-function-groups/20211216-014859
git checkout e4338a6ad34998afb60c5ad294aafa06cd7110a7
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/pinctrl/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)
>> drivers/pinctrl/pinctrl-keembay.c:1594:29: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected char const **grp @@ got char const *const *group_names @@
drivers/pinctrl/pinctrl-keembay.c:1594:29: sparse: expected char const **grp
drivers/pinctrl/pinctrl-keembay.c:1594:29: sparse: got char const *const *group_names

vim +1594 drivers/pinctrl/pinctrl-keembay.c

ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1556
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1557 static int keembay_add_functions(struct keembay_pinctrl *kpc,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1558 struct function_desc *function)
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1559 {
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1560 unsigned int i;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1561
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1562 /* Assign the groups for each function */
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1563 for (i = 0; i < kpc->npins; i++) {
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1564 const struct pinctrl_pin_desc *pdesc = keembay_pins + i;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1565 struct keembay_mux_desc *mux = pdesc->drv_data;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1566
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1567 while (mux->name) {
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1568 struct function_desc *func;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1569 const char **grp;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1570 size_t grp_size;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1571 u32 j, grp_num;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1572
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1573 for (j = 0; j < kpc->nfuncs; j++) {
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1574 if (!strcmp(mux->name, function[j].name))
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1575 break;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1576 }
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1577
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1578 if (j == kpc->nfuncs)
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1579 return -EINVAL;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1580
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1581 func = function + j;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1582 grp_num = func->num_group_names;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1583 grp_size = sizeof(*func->group_names);
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1584
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1585 if (!func->group_names) {
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1586 func->group_names = devm_kcalloc(kpc->dev,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1587 grp_num,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1588 grp_size,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1589 GFP_KERNEL);
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1590 if (!func->group_names)
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1591 return -ENOMEM;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1592 }
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1593
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 @1594 grp = func->group_names;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1595 while (*grp)
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1596 grp++;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1597
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1598 *grp = pdesc->name;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1599 mux++;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1600 }
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1601 }
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1602
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1603 /* Add all functions */
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1604 for (i = 0; i < kpc->nfuncs; i++) {
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1605 pinmux_generic_add_function(kpc->pctrl,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1606 function[i].name,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1607 function[i].group_names,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1608 function[i].num_group_names,
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1609 function[i].data);
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1610 }
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1611
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1612 return 0;
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1613 }
ffd4e739358be03 Lakshmi Sowjanya D 2021-08-06 1614

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]