Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Sneh Mankad <sneh.mankad@oss.qualcomm.com>
To: Bjorn Andersson <andersson@kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Yuanjie Yang <quic_yuanjiey@quicinc.com>
Cc: linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Sneh Mankad <sneh.mankad@oss.qualcomm.com>
Subject: [PATCH 2/3] pinctrl: qcom: Fix resolving register base address from device node
Date: Fri, 29 May 2026 18:25:45 +0530	[thread overview]
Message-ID: <20260529-tlmm_test_changes-v1-2-88bfdccb4369@oss.qualcomm.com> (raw)
In-Reply-To: <20260529-tlmm_test_changes-v1-0-88bfdccb4369@oss.qualcomm.com>

Commit 56ffb63749f4 ("pinctrl: qcom: add multi TLMM region option parameter")
added reg-names property based register reading. However multiple platforms
are not using the reg-names as they have only single TLMM register region.

Commit tried to handle this using the default_region module parameter,
however this condition is unreachable as the error return precedes it by
just checking if reg-names property exists or not, making it impossible
to use tlmm-test for the SoCs (x1e80100) which don't have reg-names
property in TLMM device.

Fix this by moving the default_region check at the start of the
tlmm_reg_base().

Fixes: 56ffb63749f4 ("pinctrl: qcom: add multi TLMM region option parameter")
Signed-off-by: Sneh Mankad <sneh.mankad@oss.qualcomm.com>
---
 drivers/pinctrl/qcom/tlmm-test.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/qcom/tlmm-test.c b/drivers/pinctrl/qcom/tlmm-test.c
index b655de5b4c5f08e7b138f0da24546274bc5fa93b..007d6539ceced294e81cfbe93a00c75a98c858de 100644
--- a/drivers/pinctrl/qcom/tlmm-test.c
+++ b/drivers/pinctrl/qcom/tlmm-test.c
@@ -581,6 +581,9 @@ static int tlmm_reg_base(struct device_node *tlmm, struct resource *res)
 	int ret;
 	int i;
 
+	if (!strcmp(tlmm_reg_name, "default_region"))
+		return of_address_to_resource(tlmm, 0, res);
+
 	count = of_property_count_strings(tlmm, "reg-names");
 	if (count <= 0) {
 		pr_err("failed to find tlmm reg name\n");
@@ -597,18 +600,14 @@ static int tlmm_reg_base(struct device_node *tlmm, struct resource *res)
 		return -EINVAL;
 	}
 
-	if (!strcmp(tlmm_reg_name, "default_region")) {
-		ret = of_address_to_resource(tlmm, 0, res);
-	} else {
-		for (i = 0; i < count; i++) {
-			if (!strcmp(reg_names[i], tlmm_reg_name)) {
-				ret = of_address_to_resource(tlmm, i, res);
-				break;
-			}
+	for (i = 0; i < count; i++) {
+		if (!strcmp(reg_names[i], tlmm_reg_name)) {
+			ret = of_address_to_resource(tlmm, i, res);
+			break;
 		}
-		if (i == count)
-			ret = -EINVAL;
 	}
+	if (i == count)
+		ret = -EINVAL;
 
 	kfree(reg_names);
 

-- 
2.34.1


  parent reply	other threads:[~2026-05-29 12:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 12:55 [PATCH 0/3] pinctrl: qcom: Correct MSM_PULL_MASK and fix resolving TLMM register address Sneh Mankad
2026-05-29 12:55 ` [PATCH 1/3] pinctrl: qcom: Modify MSM_PULL_MASK to accurately represent PULL bits Sneh Mankad
2026-06-03 13:53   ` Konrad Dybcio
2026-06-08  3:32   ` Dmitry Baryshkov
2026-05-29 12:55 ` Sneh Mankad [this message]
2026-06-08  3:34   ` [PATCH 2/3] pinctrl: qcom: Fix resolving register base address from device node Dmitry Baryshkov
2026-05-29 12:55 ` [PATCH 3/3] pinctrl: qcom: Avoid assigning thread_op_remain in unthreaded test Sneh Mankad
2026-06-03 13:58   ` Konrad Dybcio
2026-06-10  6:16     ` Sneh Mankad
2026-06-15 14:38       ` Konrad Dybcio
2026-06-08 19:31 ` [PATCH 0/3] pinctrl: qcom: Correct MSM_PULL_MASK and fix resolving TLMM register address Linus Walleij

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=20260529-tlmm_test_changes-v1-2-88bfdccb4369@oss.qualcomm.com \
    --to=sneh.mankad@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_yuanjiey@quicinc.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