mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-07 05:35:07 -05:00
checks: check for #{size,address}-cells without child nodes
Add a check for unnecessary "#{size,address}-cells" when there's neither
a 'ranges' property nor child nodes with a 'reg' property.
An exception may be an overlay that adds nodes, but this case would need
"#{size,address}-cells" in the overlay to properly compile already.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
18a3d84bb8
commit
d0c44ebe3f
1 changed files with 26 additions and 0 deletions
26
checks.c
26
checks.c
|
|
@ -981,6 +981,31 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,
|
||||||
WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
|
WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
|
||||||
&addr_size_cells);
|
&addr_size_cells);
|
||||||
|
|
||||||
|
static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *dti,
|
||||||
|
struct node *node)
|
||||||
|
{
|
||||||
|
struct property *prop;
|
||||||
|
struct node *child;
|
||||||
|
bool has_reg = false;
|
||||||
|
|
||||||
|
if (!node->parent || node->addr_cells < 0 || node->size_cells < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (get_property(node, "ranges") || !node->children)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for_each_child(node, child) {
|
||||||
|
prop = get_property(child, "reg");
|
||||||
|
if (prop)
|
||||||
|
has_reg = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_reg)
|
||||||
|
FAIL(c, dti, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property in %s",
|
||||||
|
node->fullpath);
|
||||||
|
}
|
||||||
|
WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);
|
||||||
|
|
||||||
static void check_obsolete_chosen_interrupt_controller(struct check *c,
|
static void check_obsolete_chosen_interrupt_controller(struct check *c,
|
||||||
struct dt_info *dti,
|
struct dt_info *dti,
|
||||||
struct node *node)
|
struct node *node)
|
||||||
|
|
@ -1305,6 +1330,7 @@ static struct check *check_table[] = {
|
||||||
&simple_bus_reg,
|
&simple_bus_reg,
|
||||||
|
|
||||||
&avoid_default_addr_size,
|
&avoid_default_addr_size,
|
||||||
|
&avoid_unnecessary_addr_size,
|
||||||
&obsolete_chosen_interrupt_controller,
|
&obsolete_chosen_interrupt_controller,
|
||||||
|
|
||||||
&clocks_property,
|
&clocks_property,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue