Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp820770pxk; Mon, 31 Aug 2020 01:49:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvU37+JE+livQQU0Llq6we6ak7n71i2Gkiy4e/8yLXHRZ0X0ZHTWUmRcxxnm8rPTMNVlpr X-Received: by 2002:a17:906:6d4c:: with SMTP id a12mr168515ejt.64.1598863752097; Mon, 31 Aug 2020 01:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598863752; cv=none; d=google.com; s=arc-20160816; b=WsWz1EJGj0Q9tHILNXeteW4SYfH+pdk+P44eiz0ww+rrKRNea0X2C30ZNzTYTSk/HM FXWu0m62Rd99mptKoUJ4QC4psx0lYq0/hv3fuU3sSSnsD9YC42d7wnkRBxk5Fz4U2Zxj gaX27RaR6CVaw2d/fY0QMZCWBe17vgTT3Q2kHhDiyqoxqSpnr3x/poB+AFMdv+i0U4lE BN/k58bF8w+TrPRPtUpTzebr8w6ypbwPzfdl8AQ8CrTqWanPSw/tYup+VDlOXt12cvlp 5p24P1WHDvitHhR/RtwQUKBFMJaSpYncu4CrGMn91ByXGlq6C8ActTmqCcJ6NMsEuCxQ 1U5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Bk4tyEkxbCbPZrPOLMbxi7MAdsUWcblQFRJKE4SNJAA=; b=tDAT3OWUV+GCMVL0tAig+QXZt9pa8K7BF8wLMdNOOGolFbxZ46LXtXrGjQIkWLh46D uvJ1wGKWmeAIjRCSGPcyWhYNLn+/T+4t0bwiQ73lWYrfWTks9qw9TbhijOgI9zcgMlV6 mje/2oU2zCnao7dQDbCa6y7NgANBQLHoCCc0EaB0ertDJzIRQ/XvH/1XAIDs6jGWuhpf yu+rQDFQx3ScLDXT233dkkXaMiMbKu0tA0UQp07Xa6hM1MrWv5ZHFogJbh5NFCaLTtST XJxyh6ZnWH2vTymD5VUO5W4t/zhRLoxyxHDIaQGknd8vXaToszD9UraQHrdjHquKO7fC z+sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz6si5576846edb.188.2020.08.31.01.48.49; Mon, 31 Aug 2020 01:49:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbgHaIsG (ORCPT + 99 others); Mon, 31 Aug 2020 04:48:06 -0400 Received: from lucky1.263xmail.com ([211.157.147.135]:58258 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727833AbgHaIsC (ORCPT ); Mon, 31 Aug 2020 04:48:02 -0400 Received: from localhost (unknown [192.168.167.32]) by lucky1.263xmail.com (Postfix) with ESMTP id 6F5E4A263E; Mon, 31 Aug 2020 16:47:58 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P11834T140500763920128S1598863675343235_; Mon, 31 Aug 2020 16:47:58 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <3892b05da8124e78724d07755bc66f37> X-RL-SENDER: jay.xu@rock-chips.com X-SENDER: xjq@rock-chips.com X-LOGIN-NAME: jay.xu@rock-chips.com X-FST-TO: linus.walleij@linaro.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Jianqun Xu To: linus.walleij@linaro.org, heiko@sntech.de Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Jianqun Xu Subject: [PATCH 4/6] pinctrl: rockchip: do not set gpio if bank invalid Date: Mon, 31 Aug 2020 16:47:51 +0800 Message-Id: <20200831084753.7115-5-jay.xu@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200831084753.7115-1-jay.xu@rock-chips.com> References: <20200831084753.7115-1-jay.xu@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add valid check for gpio bank. Change-Id: Ib03e2910a7316bd61df18236151e371c4d04077a Signed-off-by: Jianqun Xu --- 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