Skip to content

Commit

Permalink
pinctrl: at91: provide gpio names
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  • Loading branch information
Jean-Christophe PLAGNIOL-VILLARD committed Nov 18, 2012
1 parent f6f94f6 commit 32b01a3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/pinctrl/pinctrl-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,9 +1364,10 @@ static int __devinit at91_gpio_probe(struct platform_device *pdev)
struct gpio_chip *chip;
struct pinctrl_gpio_range *range;
int ret = 0;
int irq;
int irq, i;
int alias_idx = of_alias_get_id(np, "gpio");
uint32_t ngpio;
char **names;

BUG_ON(alias_idx >= ARRAY_SIZE(gpio_chips));
if (gpio_chips[alias_idx]) {
Expand Down Expand Up @@ -1436,6 +1437,18 @@ static int __devinit at91_gpio_probe(struct platform_device *pdev)
chip->ngpio = ngpio;
}

names = devm_kzalloc(&pdev->dev, sizeof(char*) * chip->ngpio, GFP_KERNEL);

if (!names) {
ret = -ENOMEM;
goto clk_err;
}

for (i = 0; i < chip->ngpio; i++)
names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i);

chip->names = (const char*const*)names;

range = &at91_chip->range;
range->name = chip->label;
range->id = alias_idx;
Expand Down

0 comments on commit 32b01a3

Please sign in to comment.