diff mbox series

[v1,08/17] pinctrl: core: Embed struct pingroup into struct group_desc

Message ID 20231122164040.2262742-9-andriy.shevchenko@linux.intel.com (mailing list archive)
State Superseded
Headers show
Series pinctrl: Convert struct group_desc to use struct pingroup | expand

Commit Message

Andy Shevchenko Nov. 22, 2023, 4:35 p.m. UTC
struct group_desc is a particular version of the struct pingroup
with associated opaque data. Start switching pin control core and
drivers to use it explicitly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/core.c | 15 ++++++++++++---
 drivers/pinctrl/core.h |  5 +++++
 2 files changed, 17 insertions(+), 3 deletions(-)

Comments

kernel test robot Nov. 23, 2023, 3:11 a.m. UTC | #1
Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next next-20231122]
[cannot apply to geert-renesas-drivers/renesas-pinctrl pinctrl-samsung/for-next linus/master v6.7-rc2]
[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-equilibrium-Convert-to-use-struct-pingroup/20231123-005932
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20231122164040.2262742-9-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 08/17] pinctrl: core: Embed struct pingroup into struct group_desc
config: i386-buildonly-randconfig-004-20231123 (https://download.01.org/0day-ci/archive/20231123/202311230849.YPJuLoNP-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231123/202311230849.YPJuLoNP-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311230849.YPJuLoNP-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/pinctrl/mediatek/pinctrl-moore.h:21,
                    from drivers/pinctrl/mediatek/pinctrl-mt7981.c:9:
>> drivers/pinctrl/mediatek/../core.h:217:21: error: initializer element is not constant
     217 | (struct group_desc) {                                           \
         |                     ^
   drivers/pinctrl/mediatek/pinctrl-moore.h:41:9: note: in expansion of macro 'PINCTRL_GROUP_DESC'
      41 |         PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/pinctrl-mt7981.c:795:9: note: in expansion of macro 'PINCTRL_PIN_GROUP'
     795 |         PINCTRL_PIN_GROUP("wa_aice1", mt7981_wa_aice1),
         |         ^~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/../core.h:217:21: note: (near initialization for 'mt7981_groups')
     217 | (struct group_desc) {                                           \
         |                     ^
   drivers/pinctrl/mediatek/pinctrl-moore.h:41:9: note: in expansion of macro 'PINCTRL_GROUP_DESC'
      41 |         PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/pinctrl-mt7981.c:795:9: note: in expansion of macro 'PINCTRL_PIN_GROUP'
     795 |         PINCTRL_PIN_GROUP("wa_aice1", mt7981_wa_aice1),
         |         ^~~~~~~~~~~~~~~~~
--
   In file included from drivers/pinctrl/mediatek/pinctrl-moore.h:21,
                    from drivers/pinctrl/mediatek/pinctrl-mt7623.c:11:
>> drivers/pinctrl/mediatek/../core.h:217:21: error: initializer element is not constant
     217 | (struct group_desc) {                                           \
         |                     ^
   drivers/pinctrl/mediatek/pinctrl-moore.h:41:9: note: in expansion of macro 'PINCTRL_GROUP_DESC'
      41 |         PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/pinctrl-mt7623.c:1079:9: note: in expansion of macro 'PINCTRL_PIN_GROUP'
    1079 |         PINCTRL_PIN_GROUP("aud_ext_clk0", mt7623_aud_ext_clk0),
         |         ^~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/../core.h:217:21: note: (near initialization for 'mt7623_groups')
     217 | (struct group_desc) {                                           \
         |                     ^
   drivers/pinctrl/mediatek/pinctrl-moore.h:41:9: note: in expansion of macro 'PINCTRL_GROUP_DESC'
      41 |         PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/pinctrl-mt7623.c:1079:9: note: in expansion of macro 'PINCTRL_PIN_GROUP'
    1079 |         PINCTRL_PIN_GROUP("aud_ext_clk0", mt7623_aud_ext_clk0),
         |         ^~~~~~~~~~~~~~~~~
--
   In file included from drivers/pinctrl/mediatek/pinctrl-moore.h:21,
                    from drivers/pinctrl/mediatek/pinctrl-mt7629.c:9:
>> drivers/pinctrl/mediatek/../core.h:217:21: error: initializer element is not constant
     217 | (struct group_desc) {                                           \
         |                     ^
   drivers/pinctrl/mediatek/pinctrl-moore.h:41:9: note: in expansion of macro 'PINCTRL_GROUP_DESC'
      41 |         PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/pinctrl-mt7629.c:312:9: note: in expansion of macro 'PINCTRL_PIN_GROUP'
     312 |         PINCTRL_PIN_GROUP("ephy_leds", mt7629_ephy_leds),
         |         ^~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/../core.h:217:21: note: (near initialization for 'mt7629_groups')
     217 | (struct group_desc) {                                           \
         |                     ^
   drivers/pinctrl/mediatek/pinctrl-moore.h:41:9: note: in expansion of macro 'PINCTRL_GROUP_DESC'
      41 |         PINCTRL_GROUP_DESC(name, id##_pins, ARRAY_SIZE(id##_pins), id##_funcs)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pinctrl/mediatek/pinctrl-mt7629.c:312:9: note: in expansion of macro 'PINCTRL_PIN_GROUP'
     312 |         PINCTRL_PIN_GROUP("ephy_leds", mt7629_ephy_leds),
         |         ^~~~~~~~~~~~~~~~~


vim +217 drivers/pinctrl/mediatek/../core.h

c7059c5ac70aea1 Tony Lindgren   2016-12-27  214  
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  215  /* Convenience macro to define a generic pin group descriptor */
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  216  #define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data)	\
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22 @217  (struct group_desc) {						\
4930128932e4e5e Andy Shevchenko 2023-11-22  218  	.grp = PINCTRL_PINGROUP(_name, _pins, _num_pins),	\
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  219  	.name = _name,						\
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  220  	.pins = _pins,						\
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  221  	.num_pins = _num_pins,					\
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  222  	.data = _data,						\
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  223  }
3bea9da5ae4cf43 Andy Shevchenko 2023-11-22  224
diff mbox series

Patch

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index c0354ea0597a..981e2e375a39 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -559,7 +559,10 @@  const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
 	if (!group)
 		return NULL;
 
-	return group->name;
+	if (group->name)
+		return group->name;
+
+	return group->grp.name;
 }
 EXPORT_SYMBOL_GPL(pinctrl_generic_get_group_name);
 
@@ -585,8 +588,14 @@  int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev,
 		return -EINVAL;
 	}
 
-	*pins = group->pins;
-	*num_pins = group->num_pins;
+	if (group->pins) {
+		*pins = group->pins;
+		*num_pins = group->num_pins;
+		return 0;
+	}
+
+	*pins = group->grp.pins;
+	*num_pins = group->grp.npins;
 
 	return 0;
 }
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 179948e44016..7a21af2b437e 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -194,14 +194,18 @@  struct pinctrl_maps {
 
 #ifdef CONFIG_GENERIC_PINCTRL_GROUPS
 
+#include <linux/pinctrl/pinctrl.h>
+
 /**
  * struct group_desc - generic pin group descriptor
+ * @grp: generic data of the pin group (name and pins)
  * @name: name of the pin group
  * @pins: array of pins that belong to the group
  * @num_pins: number of pins in the group
  * @data: pin controller driver specific data
  */
 struct group_desc {
+	struct pingroup grp;
 	const char *name;
 	int *pins;
 	int num_pins;
@@ -211,6 +215,7 @@  struct group_desc {
 /* Convenience macro to define a generic pin group descriptor */
 #define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data)	\
 (struct group_desc) {						\
+	.grp = PINCTRL_PINGROUP(_name, _pins, _num_pins),	\
 	.name = _name,						\
 	.pins = _pins,						\
 	.num_pins = _num_pins,					\