Commit 85174ad7 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

pinctrl: core: Embed struct pingroup into struct group_desc

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.
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231211190321.307330-5-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b0f24e02
...@@ -557,7 +557,10 @@ const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev, ...@@ -557,7 +557,10 @@ const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
if (!group) if (!group)
return NULL; return NULL;
return group->name; if (group->name)
return group->name;
return group->grp.name;
} }
EXPORT_SYMBOL_GPL(pinctrl_generic_get_group_name); EXPORT_SYMBOL_GPL(pinctrl_generic_get_group_name);
...@@ -583,8 +586,14 @@ int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev, ...@@ -583,8 +586,14 @@ int pinctrl_generic_get_group_pins(struct pinctrl_dev *pctldev,
return -EINVAL; return -EINVAL;
} }
*pins = group->pins; if (group->pins) {
*num_pins = group->num_pins; *pins = group->pins;
*num_pins = group->num_pins;
return 0;
}
*pins = group->grp.pins;
*num_pins = group->grp.npins;
return 0; return 0;
} }
......
...@@ -194,14 +194,18 @@ struct pinctrl_maps { ...@@ -194,14 +194,18 @@ struct pinctrl_maps {
#ifdef CONFIG_GENERIC_PINCTRL_GROUPS #ifdef CONFIG_GENERIC_PINCTRL_GROUPS
#include <linux/pinctrl/pinctrl.h>
/** /**
* struct group_desc - generic pin group descriptor * struct group_desc - generic pin group descriptor
* @grp: generic data of the pin group (name and pins)
* @name: name of the pin group * @name: name of the pin group
* @pins: array of pins that belong to the group * @pins: array of pins that belong to the group
* @num_pins: number of pins in the group * @num_pins: number of pins in the group
* @data: pin controller driver specific data * @data: pin controller driver specific data
*/ */
struct group_desc { struct group_desc {
struct pingroup grp;
const char *name; const char *name;
const unsigned int *pins; const unsigned int *pins;
int num_pins; int num_pins;
...@@ -211,6 +215,7 @@ struct group_desc { ...@@ -211,6 +215,7 @@ struct group_desc {
/* Convenience macro to define a generic pin group descriptor */ /* Convenience macro to define a generic pin group descriptor */
#define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data) \ #define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data) \
(struct group_desc) { \ (struct group_desc) { \
.grp = PINCTRL_PINGROUP(_name, _pins, _num_pins), \
.name = _name, \ .name = _name, \
.pins = _pins, \ .pins = _pins, \
.num_pins = _num_pins, \ .num_pins = _num_pins, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment