pinctrl: rockchip: add function node valid check

There are many kinds of nodes under pinctrl node, such as function
nodes, gpio nodes, and pcfg nodes.

The driver do a match check for the nodes, to ignore the gpio nodes.
This patch try to put the valid check as a function, it's better to
avoid error fix.

Change-Id: Ib9295fa77240f741a0a124d3235f5e2a6e51b499
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
Jianqun Xu
2021-08-27 16:50:00 +08:00
committed by Tao Huang
parent cb8e6654bb
commit 295855202f

View File

@@ -2930,13 +2930,21 @@ static const struct of_device_id rockchip_bank_match[] = {
{},
};
static bool is_function_node(const struct device_node *np)
{
if (of_match_node(rockchip_bank_match, np))
return false;
return true;
}
static void rockchip_pinctrl_child_count(struct rockchip_pinctrl *info,
struct device_node *np)
{
struct device_node *child;
for_each_child_of_node(np, child) {
if (of_match_node(rockchip_bank_match, child))
if (!is_function_node(child))
continue;
info->nfunctions++;
@@ -3080,7 +3088,7 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
i = 0;
for_each_child_of_node(np, child) {
if (of_match_node(rockchip_bank_match, child))
if (!is_function_node(child))
continue;
ret = rockchip_pinctrl_parse_functions(child, info, i++);