Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3812102pxv; Mon, 28 Jun 2021 13:33:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqSh9yG4dGDkR704Z27d8EbhoF48UpgC2afH/Fek48wHiDQ+s+Ghz/bekyI4sm6guP6lgG X-Received: by 2002:a05:6638:c2:: with SMTP id w2mr1267214jao.38.1624912385105; Mon, 28 Jun 2021 13:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624912385; cv=none; d=google.com; s=arc-20160816; b=z/oTMCgdJiDv/YgqrXG1XyVLiSzSasfVO+eOj1SKgY/PmVKqWW92JTqqA9W76EG/Eu kbXOJ9AnsMxG2TJFdoE/R+l4VyiX5bQW1Suo4j2+htrwaZPJyDegUVPCnu7ua+mnxXIE sC6sk7YEtRg8z6e/IxN68i9uIWWiXp+CoDlvE5xy1crdoUrlZ0+uKZX+5rY4cXdAKLTY W8OE8+Mqiw9h6FodzC4fgifyxzomF6waUplCovEZFux9jhPG5tbU8M9zKNfthJ9joU3s sCKiYwXw8cbo0Wze880dgbhcpVWY3z5GQ70U8b5lKzngjE+/n9JjbMtizm9dR+/PIj6B e0Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HnR4cRkA693IExbhoD+ymqfC0VqUV8evKqdF1WyY6F4=; b=OBTXATpm9rv4R4Rr2le5SbAGHY71L/EWhQ+Oc84ZD51wqtqTqKFPMens8lmGJNt8ik R2EsXX4I9vtfjZqcRHH/7Dq7UFXYMOSEN1pk/XDpMw4+8tWHoCr9UODpkRdVupIQBoOu BuoqGN8y25YiMrvDpEDqWPNN97YO7bwzQbp92V9LTTRCiiwBxA7Euv3r9f18lZkIGA7s 2vmPErDKLGvuw0lu/68uNDalMHCpaQ/9U+7m+UNZjXMFmBywgcO23gR6FHzJ6+fnPvzp 1FXQylfjYHG4ujYISHHP0u3XWn6e8SfDD8T1Ux3EudVPblfu9Zjn5htcM6MNieneC7qq aLTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bVbaxy/Q"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si1352428iow.72.2021.06.28.13.32.49; Mon, 28 Jun 2021 13:33:05 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bVbaxy/Q"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237449AbhF1PFw (ORCPT + 99 others); Mon, 28 Jun 2021 11:05:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:51688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236280AbhF1OrB (ORCPT ); Mon, 28 Jun 2021 10:47:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 057C461D1B; Mon, 28 Jun 2021 14:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624890879; bh=Gv3gxczTyAMNtTNk1rnU87eFT0Px8Z7jDPvLke/K7uI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bVbaxy/QCqULT/4vYLeJMpN+JMpjhB4ktYKEgseyq5AvQ4hUI5eZGmQBIy0f2iJq5 V2NEGSeTGEiwIG4ba7pkDxaJSlT7XwragHGjPrwARq4Bk4DO7L9nIYm9GG7xex7isk vvjHRjb2lDxd00GcuBBE96bO2ODmQB9FkrJ9E2lw0aiKSJkDBeZG/HaAxKdjf6atjK I+5g6HcdE1UzlFHO451ZTZtOMMZb2pSzxI2yFzgQIJC8LUJ+Trffc1ca1/oxRz6o9/ WU0rW/+PIjJysO6dCyS13dxEX78ioCCYaDVTKHIy6iEw6VnGCx1duX2LZHEryQt/uf 9KilGzYrAYH+A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fabien Dessenne , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 106/109] pinctrl: stm32: fix the reported number of GPIO lines per bank Date: Mon, 28 Jun 2021 10:33:02 -0400 Message-Id: <20210628143305.32978-107-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143305.32978-1-sashal@kernel.org> References: <20210628143305.32978-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.196-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.19.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.19.196-rc1 X-KernelTest-Deadline: 2021-06-30T14:32+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabien Dessenne [ Upstream commit 67e2996f72c71ebe4ac2fcbcf77e54479bb7aa11 ] Each GPIO bank supports a variable number of lines which is usually 16, but is less in some cases : this is specified by the last argument of the "gpio-ranges" bank node property. Report to the framework, the actual number of lines, so the libgpiod gpioinfo command lists the actually existing GPIO lines. Fixes: 1dc9d289154b ("pinctrl: stm32: add possibility to use gpio-ranges to declare bank range") Signed-off-by: Fabien Dessenne Link: https://lore.kernel.org/r/20210617144629.2557693-1-fabien.dessenne@foss.st.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 14dfbbd6c1c3..4e17728f2937 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -978,7 +978,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct resource res; struct reset_control *rstc; int npins = STM32_GPIO_PINS_PER_BANK; - int bank_nr, err; + int bank_nr, err, i = 0; rstc = of_reset_control_get_exclusive(np, NULL); if (!IS_ERR(rstc)) @@ -1007,9 +1007,14 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, of_property_read_string(np, "st,bank-name", &bank->gpio_chip.label); - if (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args)) { + if (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, i, &args)) { bank_nr = args.args[1] / STM32_GPIO_PINS_PER_BANK; bank->gpio_chip.base = args.args[1]; + + npins = args.args[2]; + while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, + ++i, &args)) + npins += args.args[2]; } else { bank_nr = pctl->nbanks; bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK; -- 2.30.2