On Wed, Nov 21, 2018 at 10:15:58AM -0600, Rob Herring wrote: > On Mon, Nov 19, 2018 at 4:31 PM Kumar Gala <kumar.gala@xxxxxxxxxx> wrote: > > > > There are various SoCs that have 2 different peripheral blocks at the > > same register offset. However, we might have one block marked as > > status = "disabled" and the other status = "ok". In such cases we > > shouldn't warn about duplicate unit-address. > > What about my comments on v1? Um.. yeah, I was kind of hoping for the node_is_disabled helper that Rob suggested. > > > > > Here's a cut down example that we would warning about before: > > > > /dts-v1/; > > > > / { > > #address-cells = <0x01>; > > #size-cells = <0x01>; > > > > soc { > > #address-cells = <0x01>; > > #size-cells = <0x01>; > > compatible = "simple-bus"; > > ranges; > > > > i2c0: i2c@40003000 { > > compatible = "nordic,nrf-i2c"; > > reg = <0x40003000 0x1000>; > > status = "ok"; > > }; > > > > spi0: spi@40003000 { > > compatible = "nordic,nrf-spi"; > > reg = <0x40003000 0x1000>; > > status = "disabled"; > > }; > > }; > > }; > > > > Signed-off-by: Kumar Gala <kumar.gala@xxxxxxxxxx> > > --- > > > > v2: > > * Use streq instead of strcmp > > > > checks.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > > diff --git a/checks.c b/checks.c > > index ed84e03..d7a3664 100644 > > --- a/checks.c > > +++ b/checks.c > > @@ -1192,15 +1192,30 @@ static void check_unique_unit_address(struct check *c, struct dt_info *dti, > > for_each_child(node, childa) { > > struct node *childb; > > const char *addr_a = get_unitname(childa); > > + struct property *prop; > > > > if (!strlen(addr_a)) > > continue; > > > > + prop = get_property(childa, "status"); > > + if (prop) { > > + char *str = prop->val.val; > > + if (streq("disabled", str)) > > + continue; > > + } > > + > > for_each_child(node, childb) { > > const char *addr_b = get_unitname(childb); > > if (childa == childb) > > break; > > > > + prop = get_property(childb, "status"); > > + if (prop) { > > + char *str = prop->val.val; > > + if (streq("disabled", str)) > > + continue; > > + } > > + > > if (streq(addr_a, addr_b)) > > FAIL(c, dti, childb, "duplicate unit-address (also used in node %s)", childa->fullpath); > > } > > > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature