From: Xianwei Zhao via B4 Relay <devnull+xianwei.zhao.amlogic.com@kernel.org>
To: Linus Walleij <linusw@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Xianwei Zhao <xianwei.zhao@amlogic.com>
Subject: [PATCH] pinctrl: amlogic: a4: Allow functions without groups
Date: Fri, 06 Nov 2026 07:08:46 +0000 [thread overview]
Message-ID: <20261106-debug-info-v1-1-067c5c554f91@amlogic.com> (raw)
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
Allow function nodes without child groups during device tree
parsing instead of returning an error.
Only count and parse nodes with the "func-" prefix as pinctrl
functions, ignoring other non-GPIO child nodes.
Also handle zero-sized allocations when no groups are defined
by checking for ZERO_SIZE_PTR in addition to NULL.
This allows the driver to support function nodes without
groups and avoid treating unrelated device tree nodes as
pinctrl functions.
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Add debugging information for error dts and Error pinctrl config not affect normal pin work.
---
drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
index 39eb8cc7fc0d..d0e3cec3ead0 100644
--- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
+++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
@@ -821,8 +821,10 @@ static int aml_pctl_parse_functions(struct device_node *np,
func = &info->functions[index];
func->name = np->name;
func->ngroups = of_get_child_count(np);
- if (func->ngroups == 0)
- return dev_err_probe(dev, -EINVAL, "No groups defined\n");
+ if (func->ngroups == 0) {
+ dev_dbg(dev, "func %s No groups defined\n", func->name);
+ return 0;
+ }
func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL);
if (!func->groups)
@@ -899,8 +901,12 @@ static void aml_pctl_dt_child_count(struct aml_pinctrl *info,
if (of_property_read_bool(child, "gpio-controller")) {
info->nbanks++;
} else {
- info->nfunctions++;
- info->ngroups += of_get_child_count(child);
+ if (!strncmp(child->name, "func-", 5)) {
+ info->nfunctions++;
+ info->ngroups += of_get_child_count(child);
+ } else {
+ dev_dbg(info->dev, "func node defined err %s\n", child->name);
+ }
}
}
}
@@ -1128,7 +1134,8 @@ static int aml_pctl_probe_dt(struct platform_device *pdev,
info->banks = devm_kcalloc(dev, info->nbanks, sizeof(*info->banks), GFP_KERNEL);
- if (!info->functions || !info->groups || !info->banks)
+ if (IS_ERR_OR_NULL(info->functions) || IS_ERR_OR_NULL(info->groups) ||
+ IS_ERR_OR_NULL(info->banks))
return -ENOMEM;
info->data = (struct aml_pctl_data *)of_device_get_match_data(dev);
@@ -1166,10 +1173,11 @@ static int aml_pctl_probe_dt(struct platform_device *pdev,
}
bank++;
} else {
- ret = aml_pctl_parse_functions(child, info,
- i++, &grp_index);
- if (ret)
- return ret;
+ if (!strncmp(child->name, "func-", 5)) {
+ ret = aml_pctl_parse_functions(child, info, i++, &grp_index);
+ if (ret)
+ return ret;
+ }
}
}
---
base-commit: 89edcad9f23925f5706b7555b02165d1990444d5
change-id: 20261106-debug-info-bb5611e36717
Best regards,
--
Xianwei Zhao <xianwei.zhao@amlogic.com>
reply other threads:[~2026-11-06 7:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261106-debug-info-v1-1-067c5c554f91@amlogic.com \
--to=devnull+xianwei.zhao.amlogic.com@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linusw@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=xianwei.zhao@amlogic.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
all inboxes | Powered by JetHome®