From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Linus Walleij" <linus.walleij@linaro.org>,
"Basavaraj Natikar" <Basavaraj.Natikar@amd.com>,
"Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"Avi Fishman" <avifishman70@gmail.com>,
"Tomer Maimon" <tmaimon77@gmail.com>,
"Tali Perry" <tali.perry1@gmail.com>,
"Patrick Venture" <venture@google.com>,
"Nancy Yuen" <yuenn@google.com>,
"Benjamin Fair" <benjaminfair@google.com>,
"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"David Rhodes" <david.rhodes@cirrus.com>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>,
"Charles Keepax" <ckeepax@opensource.cirrus.com>,
"Lorenzo Bianconi" <lorenzo@kernel.org>,
"Sean Wang" <sean.wang@kernel.org>,
"Jesper Nilsson" <jesper.nilsson@axis.com>,
"Lars Persson" <lars.persson@axis.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Vladimir Zapolskiy" <vz@mleia.com>,
"Michal Simek" <michal.simek@amd.com>,
"Emil Renner Berthing" <kernel@esmil.dk>,
"Jianlong Huang" <jianlong.huang@starfivetech.com>,
"Hal Feng" <hal.feng@starfivetech.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-renesas-soc@vger.kernel.org, linux-sound@vger.kernel.org,
patches@opensource.cirrus.com,
linux-mediatek@lists.infradead.org, linux-arm-kernel@axis.com,
linux-riscv@lists.infradead.org, linux-rtc@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH 10/17] pinctrl: bcm: cygnus-nsp: Move fixed assignments to 'pinctrl_desc' definition
Date: Wed, 28 May 2025 12:41:06 +0200 [thread overview]
Message-ID: <20250528-pinctrl-const-desc-v1-10-76fe97899945@linaro.org> (raw)
In-Reply-To: <20250528-pinctrl-const-desc-v1-0-76fe97899945@linaro.org>
Assign 'struct pinctrl_desc' .npins member in definition to make clear
that number of pins is fixed and have less code in the probe.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/pinctrl/bcm/pinctrl-nsp-mux.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c
index eb6298507c1d1873f9d5a90ec724b36af6d4da48..9b716c0d2b9456b9e64ca1094375effefdf4817c 100644
--- a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c
+++ b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c
@@ -525,6 +525,7 @@ static struct pinctrl_desc nsp_pinctrl_desc = {
.name = "nsp-pinmux",
.pctlops = &nsp_pinctrl_ops,
.pmxops = &nsp_pinmux_ops,
+ .npins = ARRAY_SIZE(nsp_pins),
};
static int nsp_mux_log_init(struct nsp_pinctrl *pinctrl)
@@ -556,7 +557,6 @@ static int nsp_pinmux_probe(struct platform_device *pdev)
struct resource *res;
int i, ret;
struct pinctrl_pin_desc *pins;
- unsigned int num_pins = ARRAY_SIZE(nsp_pins);
pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL);
if (!pinctrl)
@@ -589,11 +589,12 @@ static int nsp_pinmux_probe(struct platform_device *pdev)
return ret;
}
- pins = devm_kcalloc(&pdev->dev, num_pins, sizeof(*pins), GFP_KERNEL);
+ pins = devm_kcalloc(&pdev->dev, ARRAY_SIZE(nsp_pins), sizeof(*pins),
+ GFP_KERNEL);
if (!pins)
return -ENOMEM;
- for (i = 0; i < num_pins; i++) {
+ for (i = 0; i < ARRAY_SIZE(nsp_pins); i++) {
pins[i].number = nsp_pins[i].pin;
pins[i].name = nsp_pins[i].name;
pins[i].drv_data = &nsp_pins[i].gpio_select;
@@ -604,7 +605,6 @@ static int nsp_pinmux_probe(struct platform_device *pdev)
pinctrl->functions = nsp_pin_functions;
pinctrl->num_functions = ARRAY_SIZE(nsp_pin_functions);
nsp_pinctrl_desc.pins = pins;
- nsp_pinctrl_desc.npins = num_pins;
pinctrl->pctl = devm_pinctrl_register(&pdev->dev, &nsp_pinctrl_desc,
pinctrl);
--
2.45.2
next prev parent reply other threads:[~2025-05-28 10:42 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 10:40 [PATCH 00/17] pinctrl: Constify pointers to 'pinctrl_desc' and more Krzysztof Kozlowski
2025-05-28 10:40 ` [PATCH 01/17] pinctrl: starfive: Allow compile testing on other platforms Krzysztof Kozlowski
2025-05-28 12:36 ` Geert Uytterhoeven
2025-05-28 12:51 ` Krzysztof Kozlowski
2025-05-28 10:40 ` [PATCH 02/17] pinctrl: Allow compile testing for K210, TB10X and ZYNQ Krzysztof Kozlowski
2025-05-29 6:26 ` Krzysztof Kozlowski
2025-05-28 10:40 ` [PATCH 03/17] pinctrl: amd: Constify pointers to 'pinctrl_desc' Krzysztof Kozlowski
2025-05-28 10:41 ` [PATCH 04/17] pinctrl: " Krzysztof Kozlowski
2025-05-28 12:47 ` Geert Uytterhoeven
2025-05-28 10:41 ` [PATCH 05/17] pinctrl: aspeed: Constify static 'pinctrl_desc' Krzysztof Kozlowski
2025-05-29 0:39 ` Andrew Jeffery
2025-05-28 10:41 ` [PATCH 06/17] pinctrl: nuvoton: " Krzysztof Kozlowski
2025-05-28 10:41 ` [PATCH 07/17] pinctrl: bcm: " Krzysztof Kozlowski
2025-05-28 16:45 ` Florian Fainelli
2025-05-28 10:41 ` [PATCH 08/17] pinctrl: bcm: cygnus-mux: Move fixed assignments to 'pinctrl_desc' definition Krzysztof Kozlowski
2025-05-28 16:46 ` Florian Fainelli
2025-05-28 10:41 ` [PATCH 09/17] pinctrl: bcm: cygnus-ns2: " Krzysztof Kozlowski
2025-05-28 16:46 ` Florian Fainelli
2025-05-28 10:41 ` Krzysztof Kozlowski [this message]
2025-05-28 16:46 ` [PATCH 10/17] pinctrl: bcm: cygnus-nsp: " Florian Fainelli
2025-05-28 10:41 ` [PATCH 11/17] pinctrl: as3722: " Krzysztof Kozlowski
2025-05-28 10:41 ` [PATCH 12/17] pinctrl: max77620: " Krzysztof Kozlowski
2025-05-28 10:41 ` [PATCH 13/17] pinctrl: palmas: " Krzysztof Kozlowski
2025-05-28 10:41 ` [PATCH 14/17] pinctrl: renesas: " Krzysztof Kozlowski
2025-05-28 12:54 ` Geert Uytterhoeven
2025-05-28 17:55 ` Krzysztof Kozlowski
2025-05-30 8:06 ` Geert Uytterhoeven
2025-05-28 10:41 ` [PATCH 15/17] pinctrl: pistachio: Constify static 'pinctrl_desc' Krzysztof Kozlowski
2025-05-28 10:41 ` [PATCH 16/17] pinctrl: " Krzysztof Kozlowski
2025-05-28 12:51 ` Lorenzo Bianconi
2025-05-28 16:41 ` Charles Keepax
2025-06-03 9:40 ` Jesper Nilsson
2025-05-28 10:41 ` [PATCH 17/17] rtc: stm32: " Krzysztof Kozlowski
2025-06-10 12:16 ` [PATCH 00/17] pinctrl: Constify pointers to 'pinctrl_desc' and more Linus Walleij
2025-06-11 6:10 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250528-pinctrl-const-desc-v1-10-76fe97899945@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=Basavaraj.Natikar@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@codeconstruct.com.au \
--cc=angelogioacchino.delregno@collabora.com \
--cc=avifishman70@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=benjaminfair@google.com \
--cc=ckeepax@opensource.cirrus.com \
--cc=david.rhodes@cirrus.com \
--cc=dlemoal@kernel.org \
--cc=geert+renesas@glider.be \
--cc=hal.feng@starfivetech.com \
--cc=j.neuschaefer@gmx.net \
--cc=jesper.nilsson@axis.com \
--cc=jianlong.huang@starfivetech.com \
--cc=joel@jms.id.au \
--cc=kernel@esmil.dk \
--cc=lars.persson@axis.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@axis.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=lorenzo@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=michal.simek@amd.com \
--cc=openbmc@lists.ozlabs.org \
--cc=patches@opensource.cirrus.com \
--cc=rafal@milecki.pl \
--cc=rf@opensource.cirrus.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=sean.wang@kernel.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=vz@mleia.com \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).