summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/stm32
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-04-01 13:35:54 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-04-08 15:54:54 +0300
commitd9463201ec0824037a9ca84b9bb03a79d4460cfb (patch)
tree90a44be1713578feba5fd3d9e1da846f8ec5f494 /drivers/pinctrl/stm32
parent0b19dde90ad004592792a928c75e80612be3e2e8 (diff)
downloadlinux-stable-d9463201ec0824037a9ca84b9bb03a79d4460cfb.tar.gz
linux-stable-d9463201ec0824037a9ca84b9bb03a79d4460cfb.tar.bz2
linux-stable-d9463201ec0824037a9ca84b9bb03a79d4460cfb.zip
pinctrl: stm32: Replace custom code by gpiochip_node_count() call
Since we have generic function to count GPIO controller nodes under a given device, there is no need to open code it. Replace custom code by gpiochip_node_count() call. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Diffstat (limited to 'drivers/pinctrl/stm32')
-rw-r--r--drivers/pinctrl/stm32/pinctrl-stm32.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 9ed764731570..91b9a64b649e 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -1423,7 +1423,8 @@ int stm32_pctl_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct stm32_pinctrl *pctl;
struct pinctrl_pin_desc *pins;
- int i, ret, hwlock_id, banks = 0;
+ int i, ret, hwlock_id;
+ unsigned int banks;
if (!np)
return -EINVAL;
@@ -1513,10 +1514,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
return PTR_ERR(pctl->pctl_dev);
}
- for_each_available_child_of_node(np, child)
- if (of_property_read_bool(child, "gpio-controller"))
- banks++;
-
+ banks = gpiochip_node_count(dev);
if (!banks) {
dev_err(dev, "at least one GPIO bank is required\n");
return -EINVAL;