Commit ca09ce25 authored by Etienne Buira's avatar Etienne Buira Committed by Bartosz Golaszewski
Browse files

gpio: syscon: do not report bogus error



Do not issue "can't read the data register offset!" when gpio,syscon-dev
is not set albeit unneeded. gpio-syscon is used with rk3328 chip, but
this iomem region is documented in
Documentation/devicetree/bindings/gpio/rockchip,rk3328-grf-gpio.yaml and
does not require gpio,syscon-dev setting.

Signed-off-by: default avatarEtienne Buira <etienne.buira@free.fr>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/Zktwd4Y8zu6XSGaE@Z926fQmE5jqhFMgp6


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent e4608bbc
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
	struct syscon_gpio_priv *priv;
	struct device_node *np = dev->of_node;
	int ret;
	bool use_parent_regmap = false;

	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
	if (!priv)
@@ -216,11 +217,14 @@ static int syscon_gpio_probe(struct platform_device *pdev)
	priv->data = of_device_get_match_data(dev);

	priv->syscon = syscon_regmap_lookup_by_phandle(np, "gpio,syscon-dev");
	if (IS_ERR(priv->syscon) && np->parent)
	if (IS_ERR(priv->syscon) && np->parent) {
		priv->syscon = syscon_node_to_regmap(np->parent);
		use_parent_regmap = true;
	}
	if (IS_ERR(priv->syscon))
		return PTR_ERR(priv->syscon);

	if (!use_parent_regmap) {
		ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1,
						 &priv->dreg_offset);
		if (ret)
@@ -234,6 +238,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
			dev_dbg(dev, "can't read the dir register offset!\n");

		priv->dir_reg_offset <<= 3;
	}

	priv->chip.parent = dev;
	priv->chip.owner = THIS_MODULE;