summaryrefslogtreecommitdiff
path: root/components/drivers/ofw
diff options
context:
space:
mode:
authorShell <[email protected]>2024-03-28 23:42:56 +0800
committerGitHub <[email protected]>2024-03-28 23:42:56 +0800
commit83e95bdff4c48c661b50e1eec56d5fd293b28fbb (patch)
tree9e0c2065950f0804e5009da71c8e0f590224cade /components/drivers/ofw
parent40e26f4909fa61ada775ba86b44d8300aaf5d250 (diff)
sync smart & dfs (#8672)
Signed-off-by: xqyjlj <[email protected]> Signed-off-by: Shell <[email protected]> Co-authored-by: xqyjlj <[email protected]>
Diffstat (limited to 'components/drivers/ofw')
-rw-r--r--components/drivers/ofw/base.c73
1 files changed, 41 insertions, 32 deletions
diff --git a/components/drivers/ofw/base.c b/components/drivers/ofw/base.c
index 8b081bc9d4..4578758a23 100644
--- a/components/drivers/ofw/base.c
+++ b/components/drivers/ofw/base.c
@@ -1109,17 +1109,20 @@ struct rt_ofw_node *rt_ofw_get_alias_node(const char *tag, int id)
if (tag && id >= 0)
{
- rt_list_for_each_entry(info, &_aliases_nodes, list)
+ if (!rt_list_isempty(&_aliases_nodes))
{
- if (rt_strncmp(info->tag, tag, info->tag_len))
+ rt_list_for_each_entry(info, &_aliases_nodes, list)
{
- continue;
- }
+ if (rt_strncmp(info->tag, tag, info->tag_len))
+ {
+ continue;
+ }
- if (info->id == id)
- {
- np = info->np;
- break;
+ if (info->id == id)
+ {
+ np = info->np;
+ break;
+ }
}
}
}
@@ -1130,18 +1133,20 @@ struct rt_ofw_node *rt_ofw_get_alias_node(const char *tag, int id)
int ofw_alias_node_id(struct rt_ofw_node *np)
{
int id;
- struct alias_info *info;
+ struct alias_info *info = RT_NULL;
if (np)
{
id = -1;
-
- rt_list_for_each_entry(info, &_aliases_nodes, list)
+ if (!rt_list_isempty(&_aliases_nodes))
{
- if (info->np == np)
+ rt_list_for_each_entry(info, &_aliases_nodes, list)
{
- id = info->id;
- break;
+ if (info->np == np)
+ {
+ id = info->id;
+ break;
+ }
}
}
}
@@ -1161,18 +1166,20 @@ int rt_ofw_get_alias_id(struct rt_ofw_node *np, const char *tag)
if (np && tag)
{
id = -1;
-
- rt_list_for_each_entry(info, &_aliases_nodes, list)
+ if (!rt_list_isempty(&_aliases_nodes))
{
- if (rt_strncmp(info->tag, tag, info->tag_len))
+ rt_list_for_each_entry(info, &_aliases_nodes, list)
{
- continue;
- }
+ if (rt_strncmp(info->tag, tag, info->tag_len))
+ {
+ continue;
+ }
- if (info->np == np)
- {
- id = info->id;
- break;
+ if (info->np == np)
+ {
+ id = info->id;
+ break;
+ }
}
}
}
@@ -1192,17 +1199,19 @@ int rt_ofw_get_alias_last_id(const char *tag)
if (tag)
{
id = -1;
-
- rt_list_for_each_entry(info, &_aliases_nodes, list)
+ if (!rt_list_isempty(&_aliases_nodes))
{
- if (rt_strncmp(info->tag, tag, info->tag_len))
+ rt_list_for_each_entry(info, &_aliases_nodes, list)
{
- continue;
- }
+ if (rt_strncmp(info->tag, tag, info->tag_len))
+ {
+ continue;
+ }
- if (info->id > id)
- {
- id = info->id;
+ if (info->id > id)
+ {
+ id = info->id;
+ }
}
}
}
@@ -1465,7 +1474,7 @@ static const char *ofw_get_prop_fuzzy_name(const struct rt_ofw_node *np, const c
char *sf, split_field[64];
rt_size_t len = 0, max_ak = 0;
const char *str, *result = RT_NULL;
- RT_DECLARE_BITMAP(ak, sizeof(split_field));
+ RT_BITMAP_DECLARE(ak, sizeof(split_field));
struct rt_ofw_prop *prop;
/*