pinctrl: fix pinctrl_gpio_get_pinctrl_and_offset for gpio-ranges array
authorQuanyang Wang <quanyang.wang@windriver.com>
Thu, 16 Mar 2023 06:11:46 +0000 (14:11 +0800)
committerSimon Glass <sjg@chromium.org>
Sun, 2 Apr 2023 18:53:53 +0000 (06:53 +1200)
commitd0bb00adccb8fb5187b49193127729d591ebd206
tree0736c4d7b69ded1909b653c78cd7e7b22fec1703
parent2fb74a1d134bf675869e548c8f3f8c014b7ee473
pinctrl: fix pinctrl_gpio_get_pinctrl_and_offset for gpio-ranges array

Sometimes a multi-element array is used for "gpio-ranges" property in
dts file:

    qe_pio_e: gpio-controller@1460 {
        ......
        gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
        ......
    };

But the function pinctrl_gpio_get_pinctrl_and_offset can't handle this
case because the "index" argument passed to dev_read_phandle_with_args
is fixed to be "0". Use a loop to traverse the array to fix it.

Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
drivers/pinctrl/pinctrl-uclass.c