devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Borneo <antonio.borneo@foss.st.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>, <linux-gpio@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>
Cc: Antonio Borneo <antonio.borneo@foss.st.com>,
	Christophe Roullier <christophe.roullier@foss.st.com>,
	Fabien Dessenne <fabien.dessenne@foss.st.com>,
	Valentin Caron <valentin.caron@foss.st.com>
Subject: [PATCH v4 05/12] pinctrl: stm32: Rework stm32_pconf_parse_conf()
Date: Thu, 23 Oct 2025 15:26:53 +0200	[thread overview]
Message-ID: <20251023132700.1199871-6-antonio.borneo@foss.st.com> (raw)
In-Reply-To: <20251023132700.1199871-1-antonio.borneo@foss.st.com>

Reduce the number of parameters of the function by moving inside
the function the decoding of the field 'config'.

While there:
- change the type of 'param' to 'unsigned int' to handle the extra
  values not in 'enum pin_config_param';
- change the type of 'arg' to 'u32' to avoid additional conversions
  and align to 'u32' the corresponding param of __stm32_gpio_set().

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 3ebb468de830d..6c5f9e015e8e1 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -287,7 +287,7 @@ static void stm32_gpio_rif_release_semaphore(struct stm32_gpio_bank *bank, unsig
 /* GPIO functions */
 
 static inline void __stm32_gpio_set(struct stm32_gpio_bank *bank,
-	unsigned offset, int value)
+	unsigned int offset, u32 value)
 {
 	stm32_gpio_backup_value(bank, offset, value);
 
@@ -1195,10 +1195,11 @@ static bool stm32_pconf_get(struct stm32_gpio_bank *bank,
 }
 
 static int stm32_pconf_parse_conf(struct pinctrl_dev *pctldev,
-		unsigned int pin, enum pin_config_param param,
-		enum pin_config_param arg)
+		unsigned int pin, unsigned long config)
 {
 	struct stm32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
+	unsigned int param = pinconf_to_config_param(config);
+	u32 arg = pinconf_to_config_argument(config);
 	struct pinctrl_gpio_range *range;
 	struct stm32_gpio_bank *bank;
 	int offset, ret = 0;
@@ -1267,9 +1268,7 @@ static int stm32_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
 
 	for (i = 0; i < num_configs; i++) {
 		mutex_lock(&pctldev->mutex);
-		ret = stm32_pconf_parse_conf(pctldev, g->pin,
-			pinconf_to_config_param(configs[i]),
-			pinconf_to_config_argument(configs[i]));
+		ret = stm32_pconf_parse_conf(pctldev, g->pin, configs[i]);
 		mutex_unlock(&pctldev->mutex);
 		if (ret < 0)
 			return ret;
@@ -1286,9 +1285,7 @@ static int stm32_pconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
 	int i, ret;
 
 	for (i = 0; i < num_configs; i++) {
-		ret = stm32_pconf_parse_conf(pctldev, pin,
-				pinconf_to_config_param(configs[i]),
-				pinconf_to_config_argument(configs[i]));
+		ret = stm32_pconf_parse_conf(pctldev, pin, configs[i]);
 		if (ret < 0)
 			return ret;
 	}
-- 
2.34.1


  parent reply	other threads:[~2025-10-23 13:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 13:26 [PATCH v4 00/12] pinctrl: stm32: Support I/O synchronization Antonio Borneo
2025-10-23 13:26 ` [PATCH v4 01/12] pinctrl: pinconf-generic: Fix minor typos in comments Antonio Borneo
2025-10-27 22:04   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 02/12] pinctrl: pinconf-generic: Handle string values for generic properties Antonio Borneo
2025-10-27 22:10   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 03/12] pinctrl: pinconf-generic: Add properties 'skew-delay-{in,out}put-ps' Antonio Borneo
2025-10-27 22:10   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 04/12] dt-bindings: pincfg-node: " Antonio Borneo
2025-10-23 18:51   ` Conor Dooley
2025-10-27 22:11   ` Linus Walleij
2025-10-23 13:26 ` Antonio Borneo [this message]
2025-10-27 22:12   ` [PATCH v4 05/12] pinctrl: stm32: Rework stm32_pconf_parse_conf() Linus Walleij
2025-10-23 13:26 ` [PATCH v4 06/12] pinctrl: stm32: Simplify handling of backup pin status Antonio Borneo
2025-10-27 22:12   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 07/12] pinctrl: stm32: Drop useless spinlock save and restore Antonio Borneo
2025-10-27 22:13   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 08/12] pinctrl: stm32: Avoid keeping a bool value in a u32 variable Antonio Borneo
2025-10-27 22:13   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 09/12] pinctrl: stm32: Support I/O synchronization parameters Antonio Borneo
2025-10-27 22:14   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 10/12] dt-bindings: pinctrl: stm32: Use properties from pincfg-node.yaml Antonio Borneo
2025-10-23 18:42   ` Conor Dooley
2025-10-27 22:15   ` Linus Walleij
2025-10-23 13:26 ` [PATCH v4 11/12] dt-bindings: pinctrl: stm32: Support I/O synchronization parameters Antonio Borneo
2025-10-23 18:50   ` Conor Dooley
2025-10-27 22:16   ` Linus Walleij
2025-10-23 13:27 ` [PATCH v4 12/12] arm64: dts: st: Add I/O sync to eth pinctrl in stm32mp25-pinctrl.dtsi Antonio Borneo
2025-10-27 22:17   ` Linus Walleij
2025-11-14  8:35   ` Alexandre TORGUE

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=20251023132700.1199871-6-antonio.borneo@foss.st.com \
    --to=antonio.borneo@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=brgl@bgdev.pl \
    --cc=christophe.roullier@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabien.dessenne@foss.st.com \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=robh@kernel.org \
    --cc=valentin.caron@foss.st.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).