Commit 54784ff2 authored by Andy Shevchenko's avatar Andy Shevchenko

pinctrl: zynqmp: Unify pin naming

Since we have devm_kasprintf_strarray() helper, which is used in
the rest of pin control drivers, it makes sense to switch this
driver to it. The pin names are not part of any ABI and hence
there will be no regression based on that. Otherwise all generated
pin names will follow the same schema in the pin control subsystem.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3956d6c8
...@@ -809,6 +809,7 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, ...@@ -809,6 +809,7 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev,
unsigned int *npins) unsigned int *npins)
{ {
struct pinctrl_pin_desc *pins, *pin; struct pinctrl_pin_desc *pins, *pin;
char **pin_names;
int ret; int ret;
int i; int i;
...@@ -820,13 +821,14 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, ...@@ -820,13 +821,14 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev,
if (!pins) if (!pins)
return -ENOMEM; return -ENOMEM;
pin_names = devm_kasprintf_strarray(dev, ZYNQMP_PIN_PREFIX, *npins);
if (IS_ERR(pin_names))
return PTR_ERR(pin_names);
for (i = 0; i < *npins; i++) { for (i = 0; i < *npins; i++) {
pin = &pins[i]; pin = &pins[i];
pin->number = i; pin->number = i;
pin->name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", pin->name = pin_names[i];
ZYNQMP_PIN_PREFIX, i);
if (!pin->name)
return -ENOMEM;
} }
*zynqmp_pins = pins; *zynqmp_pins = 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