Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2262762pxk; Sat, 5 Sep 2020 15:10:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMF/v18pRw8jR7c3gk0RDY3C7jW1qQOTqiThHkbojWWUD70Q8SHw2PLMqeL68IDCWmGNj2 X-Received: by 2002:a17:906:d282:: with SMTP id ay2mr13296153ejb.265.1599343842151; Sat, 05 Sep 2020 15:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599343842; cv=none; d=google.com; s=arc-20160816; b=JtlcO5bxGxk+Pb68vE6rsslPWgEPzdL4GAkKcVB6inRIO6j36HGc/jciTmBl6DFfX3 oZfr5sEILMbZkqCJfLINftctdaIJ56sBxNNswbNX0bw6Fp5+gNNE9s9xZZhRJwji7afM CyS5E9ARcmcXzh6uRf7gEETs2kGiAE8U1oWaTK7bTwOpSG1bRvVUR3PRDNQML9MjpM+0 yQygfA+yTDyBcnvm0DrsbLDSChcm2OoCYU4sTh4/nXFCc0XjNvpVavfkpLgzRCGcr//6 ksW9md80p4WysL/ebr2daDrYAhyj0QKZTzmndkoNUkM8iPZ/Tvv/0C7LPEEJfBSLTL4i hFvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k5qXcYOvlOto+221+CQl0HhDVcJF2iRNKBkTDPB2SMU=; b=ceAwDp/Ch9fvVdD1/K/C6krgKO9QxszpjWJPvzCz/Y4FXu3j0oZQhl2jok7NRBDy1q 5qjpNuP+wASuHQfVqj9XTItUORIpLnarIFfIFcarEKbMSja+BlVBDe8bDCOMZY5qMXop Up69ISIkieXzs0hZocHQLeyHFYR1dyEcRwXDbK6Yo69jBGRYnSdcXTC/tOtVTfS2e8tW CLeRmV4LKauV4qlPXr6q3HHFjmf4b8wzSaO0B1s6OG3vX0xQfTiA4suWRPodzkh3kunl hyLaAz5J+ZLiQcVQ8b7G7420e+QKo8IQupjsVEXjZDbOeAvJnn2EgQD0wFHK0A0o46Tz cQNA== 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 g1si6599450ejj.660.2020.09.05.15.10.17; Sat, 05 Sep 2020 15:10:42 -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 S1728789AbgIEWJa (ORCPT + 99 others); Sat, 5 Sep 2020 18:09:30 -0400 Received: from gloria.sntech.de ([185.11.138.130]:33806 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728680AbgIEWJ2 (ORCPT ); Sat, 5 Sep 2020 18:09:28 -0400 Received: from ip5f5aa64a.dynamic.kabel-deutschland.de ([95.90.166.74] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEgNC-0005mD-Pd; Sun, 06 Sep 2020 00:09:26 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: linus.walleij@linaro.org, Jianqun Xu Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Jianqun Xu Subject: Re: [PATCH 4/6] pinctrl: rockchip: do not set gpio if bank invalid Date: Sun, 06 Sep 2020 00:09:26 +0200 Message-ID: <1687104.4lZP0y4C37@diego> In-Reply-To: <20200831084753.7115-5-jay.xu@rock-chips.com> References: <20200831084753.7115-1-jay.xu@rock-chips.com> <20200831084753.7115-5-jay.xu@rock-chips.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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; >