Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: qcom: Use platform_irq_count() instead of of_irq_count()

of_irq_count() is not an exported symbol (and it shouldn't be
used by platform drivers anyway) so use platform_irq_count()
instead. This allows us to make the qcom pinctrl drivers modular
again.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: Bjorn Andersson <bjorn@kryo.se>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Stephen Boyd and committed by
Linus Walleij
a5ea13f0 4b83555d

+18 -8
+3 -1
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
··· 702 702 return ret; 703 703 } 704 704 705 - npins = of_irq_count(dev->of_node); 705 + npins = platform_irq_count(pdev); 706 706 if (!npins) 707 707 return -EINVAL; 708 + if (npins < 0) 709 + return npins; 708 710 709 711 BUG_ON(npins > ARRAY_SIZE(pmic_gpio_groups)); 710 712
+3 -1
drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
··· 804 804 return ret; 805 805 } 806 806 807 - npins = of_irq_count(dev->of_node); 807 + npins = platform_irq_count(pdev); 808 808 if (!npins) 809 809 return -EINVAL; 810 + if (npins < 0) 811 + return npins; 810 812 811 813 BUG_ON(npins > ARRAY_SIZE(pmic_mpp_groups)); 812 814
+6 -3
drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
··· 667 667 struct pinctrl_pin_desc *pins; 668 668 struct pm8xxx_gpio *pctrl; 669 669 int ret; 670 - int i; 670 + int i, npins; 671 671 672 672 pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); 673 673 if (!pctrl) 674 674 return -ENOMEM; 675 675 676 676 pctrl->dev = &pdev->dev; 677 - pctrl->npins = of_irq_count(pdev->dev.of_node); 678 - if (!pctrl->npins) 677 + npins = platform_irq_count(pdev); 678 + if (!npins) 679 679 return -EINVAL; 680 + if (npins < 0) 681 + return npins; 682 + pctrl->npins = npins; 680 683 681 684 pctrl->regmap = dev_get_regmap(pdev->dev.parent, NULL); 682 685 if (!pctrl->regmap) {
+6 -3
drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c
··· 758 758 struct pinctrl_pin_desc *pins; 759 759 struct pm8xxx_mpp *pctrl; 760 760 int ret; 761 - int i; 761 + int i, npins; 762 762 763 763 pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); 764 764 if (!pctrl) 765 765 return -ENOMEM; 766 766 767 767 pctrl->dev = &pdev->dev; 768 - pctrl->npins = of_irq_count(pdev->dev.of_node); 769 - if (!pctrl->npins) 768 + npins = platform_irq_count(pdev); 769 + if (!npins) 770 770 return -EINVAL; 771 + if (npins < 0) 772 + return npins; 773 + pctrl->npins = npins; 771 774 772 775 pctrl->regmap = dev_get_regmap(pdev->dev.parent, NULL); 773 776 if (!pctrl->regmap) {