Skip to content

Commit bda2127

Browse files
Nicolas Saenz Juliennerobherring
authored andcommitted
of: unittest: Use bigger address cells to catch parser regressions
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 7cc3d50 commit bda2127

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/of/unittest-data/tests-address.dtsi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
};
2424

2525
bus@80000000 {
26-
#address-cells = <1>;
27-
#size-cells = <1>;
28-
ranges = <0x0 0x80000000 0x100000>;
29-
dma-ranges = <0x10000000 0x0 0x40000000>;
26+
#address-cells = <2>;
27+
#size-cells = <2>;
28+
ranges = <0x0 0x0 0x80000000 0x0 0x100000>;
29+
dma-ranges = <0x1 0x0 0x0 0x20 0x0>;
3030

3131
device@1000 {
32-
reg = <0x1000 0x1000>;
32+
reg = <0x0 0x1000 0x0 0x1000>;
3333
};
3434
};
3535

drivers/of/unittest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static void __init of_unittest_parse_dma_ranges(void)
900900
of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000",
901901
0x0, 0x20000000, 0x40000000);
902902
of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000",
903-
0x10000000, 0x20000000, 0x40000000);
903+
0x100000000, 0x20000000, 0x2000000000);
904904
of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000",
905905
0x80000000, 0x20000000, 0x10000000);
906906
}

0 commit comments

Comments
 (0)