Skip to content

Commit

Permalink
of: unittest: Use bigger address cells to catch parser regressions
Browse files Browse the repository at this point in the history
Getting address and size cells for dma-ranges/ranges parsing is tricky
and shouldn't rely on the node's count_cells() method. The function
starts looking for cells on the parent node, as its supposed to work
with device nodes, which doesn't work when input with bus nodes, as
generally done when parsing ranges.

Add test to catch regressions on that specific quirk as developers will
be tempted to edit it out in favor of the default method.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/9200970a917a9cabdc5b17483b5a8725111eb9d0.camel@suse.de
Signed-off-by: Rob Herring <robh@kernel.org>
  • Loading branch information
Nicolas Saenz Julienne authored and Rob Herring committed Aug 3, 2020
1 parent 7cc3d50 commit bda2127
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions drivers/of/unittest-data/tests-address.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
};

bus@80000000 {
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x80000000 0x100000>;
dma-ranges = <0x10000000 0x0 0x40000000>;
#address-cells = <2>;
#size-cells = <2>;
ranges = <0x0 0x0 0x80000000 0x0 0x100000>;
dma-ranges = <0x1 0x0 0x0 0x20 0x0>;

device@1000 {
reg = <0x1000 0x1000>;
reg = <0x0 0x1000 0x0 0x1000>;
};
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/of/unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ static void __init of_unittest_parse_dma_ranges(void)
of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000",
0x0, 0x20000000, 0x40000000);
of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000",
0x10000000, 0x20000000, 0x40000000);
0x100000000, 0x20000000, 0x2000000000);
of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000",
0x80000000, 0x20000000, 0x10000000);
}
Expand Down

0 comments on commit bda2127

Please sign in to comment.