Skip to content

Commit

Permalink
Merge branch 'dgibson:main' into annotate_patch
Browse files Browse the repository at this point in the history
  • Loading branch information
bmx666 authored Feb 7, 2023
2 parents 5094a5c + 9b62ec8 commit fb27309
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
if (!node->parent || node->addr_cells < 0 || node->size_cells < 0)
return;

if (get_property(node, "ranges") || !node->children)
if (get_property(node, "ranges") || get_property(node, "dma-ranges") || !node->children)
return;

for_each_child(node, child) {
Expand All @@ -1232,7 +1232,7 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
}

if (!has_reg)
FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property");
FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or child \"reg\" property");
}
WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);

Expand Down
4 changes: 2 additions & 2 deletions libfdt/fdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ struct fdt_reserve_entry {

struct fdt_node_header {
fdt32_t tag;
char name[0];
char name[];
};

struct fdt_property {
fdt32_t tag;
fdt32_t len;
fdt32_t nameoff;
char data[0];
char data[];
};

#endif /* !__ASSEMBLY */
Expand Down
11 changes: 7 additions & 4 deletions pylibfdt/libfdt.i
Original file line number Diff line number Diff line change
Expand Up @@ -443,23 +443,23 @@ class FdtRo(object):
"""
return fdt_get_alias(self._fdt, name)

def get_path(self, nodeoffset, quiet=()):
def get_path(self, nodeoffset, size_hint=1024, quiet=()):
"""Get the full path of a node
Args:
nodeoffset: Node offset to check
size_hint: Hint for size of returned string
Returns:
Full path to the node
Raises:
FdtException if an error occurs
"""
size = 1024
while True:
ret, path = fdt_get_path(self._fdt, nodeoffset, size)
ret, path = fdt_get_path(self._fdt, nodeoffset, size_hint)
if ret == -NOSPACE:
size = size * 2
size_hint *= 2
continue
err = check_err(ret, quiet)
if err:
Expand Down Expand Up @@ -1036,6 +1036,9 @@ class NodeAdder():

%rename(fdt_property) fdt_property_func;

%immutable fdt_property::data;
%immutable fdt_node_header::name;

/*
* fdt32_t is a big-endian 32-bit value defined to uint32_t in libfdt_env.h
* so use the same type here.
Expand Down
1 change: 1 addition & 0 deletions tests/pylibfdt_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def testGetPath(self):
node2 = self.fdt.path_offset('/subnode@1/subsubnode')
self.assertEqual("/subnode@1", self.fdt.get_path(node))
self.assertEqual("/subnode@1/subsubnode", self.fdt.get_path(node2))
self.assertEqual("/subnode@1/subsubnode", self.fdt.get_path(node2, size_hint=1))

with self.assertRaises(FdtException) as e:
self.fdt.get_path(-1)
Expand Down

0 comments on commit fb27309

Please sign in to comment.