Commit de227ed7 authored by Sean Wang's avatar Sean Wang Committed by Linus Walleij

pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range

If the pinctrl node has the gpio-ranges property, the range will be added
by the gpio core and doesn't need to be added by the pinctrl driver.

But for keeping backward compatibility, an explicit pinctrl_add_gpio_range
is still needed to be called when there is a missing gpio-ranges in pinctrl
node in old dts files.

Cc: stable@vger.kernel.org
Fixes: d6ed9355 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ae6efcae
...@@ -1508,12 +1508,21 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) ...@@ -1508,12 +1508,21 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np)
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Just for backward compatible for these old pinctrl nodes without
* "gpio-ranges" property. Otherwise, called directly from a
* DeviceTree-supported pinctrl driver is DEPRECATED.
* Please see Section 2.1 of
* Documentation/devicetree/bindings/gpio/gpio.txt on how to
* bind pinctrl and gpio drivers via the "gpio-ranges" property.
*/
if (!of_find_property(np, "gpio-ranges", NULL)) {
ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0, ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0,
chip->ngpio); chip->ngpio);
if (ret < 0) { if (ret < 0) {
gpiochip_remove(chip); gpiochip_remove(chip);
return ret; return ret;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment