pinctrl: pinmux: Embed struct pinfunction into struct function_desc
struct function_desc is a particular version of the struct pinfunction with associated opaque data. Start switching pin control core and drivers to use it explicitly. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240530085745.1539925-7-andy.shevchenko@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
f26945d76a
commit
37997d7b55
@ -796,7 +796,7 @@ pinmux_generic_get_function_name(struct pinctrl_dev *pctldev,
|
|||||||
if (!function)
|
if (!function)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return function->name;
|
return function->func.name;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pinmux_generic_get_function_name);
|
EXPORT_SYMBOL_GPL(pinmux_generic_get_function_name);
|
||||||
|
|
||||||
@ -805,12 +805,12 @@ EXPORT_SYMBOL_GPL(pinmux_generic_get_function_name);
|
|||||||
* @pctldev: pin controller device
|
* @pctldev: pin controller device
|
||||||
* @selector: function number
|
* @selector: function number
|
||||||
* @groups: array of pin groups
|
* @groups: array of pin groups
|
||||||
* @num_groups: number of pin groups
|
* @ngroups: number of pin groups
|
||||||
*/
|
*/
|
||||||
int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev,
|
int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev,
|
||||||
unsigned int selector,
|
unsigned int selector,
|
||||||
const char * const **groups,
|
const char * const **groups,
|
||||||
unsigned int * const num_groups)
|
unsigned int * const ngroups)
|
||||||
{
|
{
|
||||||
struct function_desc *function;
|
struct function_desc *function;
|
||||||
|
|
||||||
@ -821,8 +821,8 @@ int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev,
|
|||||||
__func__, selector);
|
__func__, selector);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*groups = function->group_names;
|
*groups = function->func.groups;
|
||||||
*num_groups = function->num_group_names;
|
*ngroups = function->func.ngroups;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -133,12 +133,14 @@ static inline void pinmux_init_device_debugfs(struct dentry *devroot,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* struct function_desc - generic function descriptor
|
* struct function_desc - generic function descriptor
|
||||||
|
* @func: generic data of the pin function (name and groups of pins)
|
||||||
* @name: name of the function
|
* @name: name of the function
|
||||||
* @group_names: array of pin group names
|
* @group_names: array of pin group names
|
||||||
* @num_group_names: number of pin group names
|
* @num_group_names: number of pin group names
|
||||||
* @data: pin controller driver specific data
|
* @data: pin controller driver specific data
|
||||||
*/
|
*/
|
||||||
struct function_desc {
|
struct function_desc {
|
||||||
|
struct pinfunction func;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char * const *group_names;
|
const char * const *group_names;
|
||||||
int num_group_names;
|
int num_group_names;
|
||||||
@ -148,6 +150,7 @@ struct function_desc {
|
|||||||
/* Convenient macro to define a generic pin function descriptor */
|
/* Convenient macro to define a generic pin function descriptor */
|
||||||
#define PINCTRL_FUNCTION_DESC(_name, _grps, _num_grps, _data) \
|
#define PINCTRL_FUNCTION_DESC(_name, _grps, _num_grps, _data) \
|
||||||
(struct function_desc) { \
|
(struct function_desc) { \
|
||||||
|
.func = PINCTRL_PINFUNCTION(_name, _grps, _num_grps), \
|
||||||
.name = _name, \
|
.name = _name, \
|
||||||
.group_names = _grps, \
|
.group_names = _grps, \
|
||||||
.num_group_names = _num_grps, \
|
.num_group_names = _num_grps, \
|
||||||
@ -163,7 +166,7 @@ pinmux_generic_get_function_name(struct pinctrl_dev *pctldev,
|
|||||||
int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev,
|
int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev,
|
||||||
unsigned int selector,
|
unsigned int selector,
|
||||||
const char * const **groups,
|
const char * const **groups,
|
||||||
unsigned int * const num_groups);
|
unsigned int * const ngroups);
|
||||||
|
|
||||||
struct function_desc *pinmux_generic_get_function(struct pinctrl_dev *pctldev,
|
struct function_desc *pinmux_generic_get_function(struct pinctrl_dev *pctldev,
|
||||||
unsigned int selector);
|
unsigned int selector);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user