.. | .. |
---|
603 | 603 | .resume_noirq = brcmstb_gpio_resume, |
---|
604 | 604 | }; |
---|
605 | 605 | |
---|
| 606 | +static void brcmstb_gpio_set_names(struct device *dev, |
---|
| 607 | + struct brcmstb_gpio_bank *bank) |
---|
| 608 | +{ |
---|
| 609 | + struct device_node *np = dev->of_node; |
---|
| 610 | + const char **names; |
---|
| 611 | + int nstrings, base; |
---|
| 612 | + unsigned int i; |
---|
| 613 | + |
---|
| 614 | + base = bank->id * MAX_GPIO_PER_BANK; |
---|
| 615 | + |
---|
| 616 | + nstrings = of_property_count_strings(np, "gpio-line-names"); |
---|
| 617 | + if (nstrings <= base) |
---|
| 618 | + /* Line names not present */ |
---|
| 619 | + return; |
---|
| 620 | + |
---|
| 621 | + names = devm_kcalloc(dev, MAX_GPIO_PER_BANK, sizeof(*names), |
---|
| 622 | + GFP_KERNEL); |
---|
| 623 | + if (!names) |
---|
| 624 | + return; |
---|
| 625 | + |
---|
| 626 | + /* |
---|
| 627 | + * Make sure to not index beyond the end of the number of descriptors |
---|
| 628 | + * of the GPIO device. |
---|
| 629 | + */ |
---|
| 630 | + for (i = 0; i < bank->width; i++) { |
---|
| 631 | + const char *name; |
---|
| 632 | + int ret; |
---|
| 633 | + |
---|
| 634 | + ret = of_property_read_string_index(np, "gpio-line-names", |
---|
| 635 | + base + i, &name); |
---|
| 636 | + if (ret) { |
---|
| 637 | + if (ret != -ENODATA) |
---|
| 638 | + dev_err(dev, "unable to name line %d: %d\n", |
---|
| 639 | + base + i, ret); |
---|
| 640 | + break; |
---|
| 641 | + } |
---|
| 642 | + if (*name) |
---|
| 643 | + names[i] = name; |
---|
| 644 | + } |
---|
| 645 | + |
---|
| 646 | + bank->gc.names = names; |
---|
| 647 | +} |
---|
| 648 | + |
---|
606 | 649 | static int brcmstb_gpio_probe(struct platform_device *pdev) |
---|
607 | 650 | { |
---|
608 | 651 | struct device *dev = &pdev->dev; |
---|
.. | .. |
---|
636 | 679 | |
---|
637 | 680 | if (of_property_read_bool(np, "interrupt-controller")) { |
---|
638 | 681 | priv->parent_irq = platform_get_irq(pdev, 0); |
---|
639 | | - if (priv->parent_irq <= 0) { |
---|
640 | | - dev_err(dev, "Couldn't get IRQ"); |
---|
| 682 | + if (priv->parent_irq <= 0) |
---|
641 | 683 | return -ENOENT; |
---|
642 | | - } |
---|
643 | 684 | } else { |
---|
644 | 685 | priv->parent_irq = -ENOENT; |
---|
645 | 686 | } |
---|
.. | .. |
---|
728 | 769 | need_wakeup_event |= !!__brcmstb_gpio_get_active_irqs(bank); |
---|
729 | 770 | gc->write_reg(reg_base + GIO_MASK(bank->id), 0); |
---|
730 | 771 | |
---|
| 772 | + brcmstb_gpio_set_names(dev, bank); |
---|
731 | 773 | err = gpiochip_add_data(gc, bank); |
---|
732 | 774 | if (err) { |
---|
733 | 775 | dev_err(dev, "Could not add gpiochip for bank %d\n", |
---|