aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-at91.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-11-06 11:33:34 -0500
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-11-18 17:35:37 -0500
commit32b01a366eb5d7d480570fe05d1dc18170387f5f (patch)
treeb2f6a80115609b52015b10c70e4d7a8bab508a16 /drivers/pinctrl/pinctrl-at91.c
parentf6f94f6660dbe34039e5c86a46c7845589e7ee0c (diff)
pinctrl: at91: provide gpio names
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'drivers/pinctrl/pinctrl-at91.c')
-rw-r--r--drivers/pinctrl/pinctrl-at91.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index b9e2cbd2ea7b..401fc96f577e 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1364,9 +1364,10 @@ static int __devinit at91_gpio_probe(struct platform_device *pdev)
1364 struct gpio_chip *chip; 1364 struct gpio_chip *chip;
1365 struct pinctrl_gpio_range *range; 1365 struct pinctrl_gpio_range *range;
1366 int ret = 0; 1366 int ret = 0;
1367 int irq; 1367 int irq, i;
1368 int alias_idx = of_alias_get_id(np, "gpio"); 1368 int alias_idx = of_alias_get_id(np, "gpio");
1369 uint32_t ngpio; 1369 uint32_t ngpio;
1370 char **names;
1370 1371
1371 BUG_ON(alias_idx >= ARRAY_SIZE(gpio_chips)); 1372 BUG_ON(alias_idx >= ARRAY_SIZE(gpio_chips));
1372 if (gpio_chips[alias_idx]) { 1373 if (gpio_chips[alias_idx]) {
@@ -1436,6 +1437,18 @@ static int __devinit at91_gpio_probe(struct platform_device *pdev)
1436 chip->ngpio = ngpio; 1437 chip->ngpio = ngpio;
1437 } 1438 }
1438 1439
1440 names = devm_kzalloc(&pdev->dev, sizeof(char*) * chip->ngpio, GFP_KERNEL);
1441
1442 if (!names) {
1443 ret = -ENOMEM;
1444 goto clk_err;
1445 }
1446
1447 for (i = 0; i < chip->ngpio; i++)
1448 names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i);
1449
1450 chip->names = (const char*const*)names;
1451
1439 range = &at91_chip->range; 1452 range = &at91_chip->range;
1440 range->name = chip->label; 1453 range->name = chip->label;
1441 range->id = alias_idx; 1454 range->id = alias_idx;