[PATCH 4/6] pinctrl: rockchip: do not set gpio if bank invalid
Heiko Stübner
heiko at sntech.de
Sat Sep 5 18:09:26 EDT 2020
Am Montag, 31. August 2020, 10:47:51 CEST schrieb Jianqun Xu:
> Add valid check for gpio bank.
As this obviously fixes a problem you encountered please elaborate a bit more.
Just so that people reading the log later understand when this issue surfaced.
Also - maybe even more important - why is this limited to PIN_CONFIG_OUTPUT?
Like when the whole bank is not valid, you should be able to return the -ENOTSUPP
even before entering the "for" loop in these functions.
> Change-Id: Ib03e2910a7316bd61df18236151e371c4d04077a
Please remove the changeId.
Thanks
Heiko
> Signed-off-by: Jianqun Xu <jay.xu at rock-chips.com>
> ---
> drivers/pinctrl/pinctrl-rockchip.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index 265d64b8c4f5..6080573155f6 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -2687,6 +2687,9 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
> return rc;
> break;
> case PIN_CONFIG_OUTPUT:
> + if (!bank->valid)
> + return -ENOTSUPP;
> +
> rockchip_gpio_set(&bank->gpio_chip,
> pin - bank->pin_base, arg);
> rc = _rockchip_pmx_gpio_set_direction(&bank->gpio_chip,
> @@ -2752,6 +2755,9 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
> arg = 1;
> break;
> case PIN_CONFIG_OUTPUT:
> + if (!bank->valid)
> + return -ENOTSUPP;
> +
> rc = rockchip_get_mux(bank, pin - bank->pin_base);
> if (rc != RK_FUNC_GPIO)
> return -EINVAL;
>
More information about the Linux-rockchip
mailing list