Commit d9463201 authored by Andy Shevchenko's avatar Andy Shevchenko
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarFabien Dessenne <fabien.dessenne@foss.st.com>
parent 0b19dde9
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -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;