pinctrl: meson: use gpio-ranges from DT
authorNeil Armstrong <narmstrong@baylibre.com>
Thu, 23 Mar 2017 16:27:28 +0000 (17:27 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 Mar 2017 09:40:24 +0000 (11:40 +0200)
When trying to add a gpio-hog, we enter a weird loop where the gpio-ranges
is needed when gpiochip_add_data() is called but in the current implementation
the ranges are added from the driver afterwards.

A simple solution is to rely on the DR gpio-ranges attribute and remove the
call to gpiochip_add_pin_range().

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/meson/pinctrl-meson.c

index cf1686e04378683cd3907c30fa97f838df0acc99..66ed70c1273312fbd30befcfc65a5d08ce0e7453 100644 (file)
@@ -555,22 +555,10 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
        if (ret) {
                dev_err(pc->dev, "can't add gpio chip %s\n",
                        pc->data->name);
-               goto fail;
-       }
-
-       ret = gpiochip_add_pin_range(&pc->chip, dev_name(pc->dev),
-                                    0, pc->data->pin_base,
-                                    pc->chip.ngpio);
-       if (ret) {
-               dev_err(pc->dev, "can't add pin range\n");
-               goto fail;
+               return ret;
        }
 
        return 0;
-fail:
-       gpiochip_remove(&pc->chip);
-
-       return ret;
 }
 
 static struct regmap_config meson_regmap_config = {