Skip to content

Commit

Permalink
pinctrl: keembay: Convert to use func member
Browse files Browse the repository at this point in the history
Convert drivers to use func member embedded in struct function_desc,
because other members will be removed to avoid duplication and
desynchronisation of the generic pin function description.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240530085745.1539925-10-andy.shevchenko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Andy Shevchenko authored and Linus Walleij committed Jun 17, 2024
1 parent be9e92a commit ab8866c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/pinctrl/pinctrl-keembay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ static int keembay_add_functions(struct keembay_pinctrl *kpc,
unsigned int grp_idx = 0;
int j;

group_names = devm_kcalloc(kpc->dev, func->num_group_names,
group_names = devm_kcalloc(kpc->dev, func->func.ngroups,
sizeof(*group_names), GFP_KERNEL);
if (!group_names)
return -ENOMEM;
Expand All @@ -1576,20 +1576,20 @@ static int keembay_add_functions(struct keembay_pinctrl *kpc,
struct keembay_mux_desc *mux;

for (mux = pdesc->drv_data; mux->name; mux++) {
if (!strcmp(mux->name, func->name))
if (!strcmp(mux->name, func->func.name))
group_names[grp_idx++] = pdesc->name;
}
}

func->group_names = group_names;
func->func.groups = group_names;
}

/* Add all functions */
for (i = 0; i < kpc->nfuncs; i++) {
pinmux_generic_add_function(kpc->pctrl,
functions[i].name,
functions[i].group_names,
functions[i].num_group_names,
functions[i].func.name,
functions[i].func.groups,
functions[i].func.ngroups,
functions[i].data);
}

Expand Down Expand Up @@ -1619,17 +1619,17 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
struct function_desc *fdesc;

/* Check if we already have function for this mux */
for (fdesc = keembay_funcs; fdesc->name; fdesc++) {
if (!strcmp(mux->name, fdesc->name)) {
fdesc->num_group_names++;
for (fdesc = keembay_funcs; fdesc->func.name; fdesc++) {
if (!strcmp(mux->name, fdesc->func.name)) {
fdesc->func.ngroups++;
break;
}
}

/* Setup new function for this mux we didn't see before */
if (!fdesc->name) {
fdesc->name = mux->name;
fdesc->num_group_names = 1;
fdesc->func.name = mux->name;
fdesc->func.ngroups = 1;
fdesc->data = &mux->mode;
kpc->nfuncs++;
}
Expand Down

0 comments on commit ab8866c

Please sign in to comment.