mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 08:17:40 -04:00
checks: Relax avoid_unnecessary_addr_size check to allow child ranges properties
Do not fail the unnecessary #address-cells/#size-cells check if any children of the node have a "ranges" property. Suggested-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/all/CAL_JsqKebRL454poAYZ9i=sCsHqGzmocLy0psQcng-79UWJB-A@mail.gmail.com/ Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Message-ID: <20241106130108.852323-1-p.zabel@pengutronix.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
66c7d0e6f4
commit
6f183c7d92
1 changed files with 10 additions and 7 deletions
17
checks.c
17
checks.c
|
@ -1217,9 +1217,7 @@ WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
|
|||
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;
|
||||
|
@ -1228,13 +1226,18 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
|
|||
return;
|
||||
|
||||
for_each_child(node, child) {
|
||||
prop = get_property(child, "reg");
|
||||
if (prop)
|
||||
has_reg = true;
|
||||
/*
|
||||
* Even if the child devices' address space is not mapped into
|
||||
* the parent bus (no 'ranges' property on node), children can
|
||||
* still have registers on a local bus, or map local addresses
|
||||
* to another subordinate address space. The properties on the
|
||||
* child nodes then make #address-cells/#size-cells necessary:
|
||||
*/
|
||||
if (get_property(child, "reg") || get_property(child, "ranges"))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!has_reg)
|
||||
FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or child \"reg\" property");
|
||||
FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or child \"reg\" or \"ranges\" property");
|
||||
}
|
||||
WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue