Skip to content

Commit 418ee94

Browse files
andy-shevlinusw
authored andcommitted
pinctrl: aw9523: Make use of struct pinfunction and PINCTRL_PINFUNCTION()
Since pin control provides a generic data type and a macro for the pin function definition, use them in the driver. Signed-off-by: Andy Shevchenko <[email protected]> Message-ID: <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 091655b commit 418ee94

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

drivers/pinctrl/pinctrl-aw9523.c

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,6 @@ struct aw9523_irq {
6666
u16 cached_gpio;
6767
};
6868

69-
/*
70-
* struct aw9523_pinmux - Pin mux params
71-
* @name: Name of the mux
72-
* @grps: Groups of the mux
73-
* @num_grps: Number of groups (sizeof array grps)
74-
*/
75-
struct aw9523_pinmux {
76-
const char *name;
77-
const char * const *grps;
78-
const u8 num_grps;
79-
};
80-
8169
/*
8270
* struct aw9523 - Main driver structure
8371
* @dev: device handle
@@ -158,17 +146,9 @@ static const char * const gpio_pwm_groups[] = {
158146
};
159147

160148
/* Warning: Do NOT reorder this array */
161-
static const struct aw9523_pinmux aw9523_pmx[] = {
162-
{
163-
.name = "pwm",
164-
.grps = gpio_pwm_groups,
165-
.num_grps = ARRAY_SIZE(gpio_pwm_groups),
166-
},
167-
{
168-
.name = "gpio",
169-
.grps = gpio_pwm_groups,
170-
.num_grps = ARRAY_SIZE(gpio_pwm_groups),
171-
},
149+
static const struct pinfunction aw9523_pmx[] = {
150+
PINCTRL_PINFUNCTION("pwm", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
151+
PINCTRL_PINFUNCTION("gpio", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
172152
};
173153

174154
static int aw9523_pmx_get_funcs_count(struct pinctrl_dev *pctl)
@@ -184,10 +164,10 @@ static const char *aw9523_pmx_get_fname(struct pinctrl_dev *pctl,
184164

185165
static int aw9523_pmx_get_groups(struct pinctrl_dev *pctl, unsigned int sel,
186166
const char * const **groups,
187-
unsigned int * const num_groups)
167+
unsigned int * const ngroups)
188168
{
189-
*groups = aw9523_pmx[sel].grps;
190-
*num_groups = aw9523_pmx[sel].num_grps;
169+
*groups = aw9523_pmx[sel].groups;
170+
*ngroups = aw9523_pmx[sel].ngroups;
191171
return 0;
192172
}
193173

0 commit comments

Comments
 (0)