[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200831084753.7115-5-jay.xu@rock-chips.com>
Date: Mon, 31 Aug 2020 16:47:51 +0800
From: Jianqun Xu <jay.xu@...k-chips.com>
To: linus.walleij@...aro.org, heiko@...ech.de
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rockchip@...ts.infradead.org,
Jianqun Xu <jay.xu@...k-chips.com>
Subject: [PATCH 4/6] pinctrl: rockchip: do not set gpio if bank invalid
Add valid check for gpio bank.
Change-Id: Ib03e2910a7316bd61df18236151e371c4d04077a
Signed-off-by: Jianqun Xu <jay.xu@...k-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;
--
2.17.1
Powered by blists - more mailing lists