提交 c680e9ab 编写于 作者: U Uwe Kleine-König 提交者: Rob Herring

iommu: pass cell_count = -1 to of_for_each_phandle with cells_name

Currently of_for_each_phandle ignores the cell_count parameter when a
cells_name is given. I intend to change that and let the iterator fall
back to a non-negative cell_count if the cells_name property is missing
in the referenced node.

To not change how existing of_for_each_phandle's users iterate, fix them
to pass cell_count = -1 when also cells_name is given which yields the
expected behaviour with and without my change.
Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: NJoerg Roedel <jroedel@suse.de>
Signed-off-by: NRob Herring <robh@kernel.org>
上级 693af5f3
...@@ -333,7 +333,7 @@ static int __find_legacy_master_phandle(struct device *dev, void *data) ...@@ -333,7 +333,7 @@ static int __find_legacy_master_phandle(struct device *dev, void *data)
int err; int err;
of_for_each_phandle(it, err, dev->of_node, "mmu-masters", of_for_each_phandle(it, err, dev->of_node, "mmu-masters",
"#stream-id-cells", 0) "#stream-id-cells", -1)
if (it->node == np) { if (it->node == np) {
*(void **)data = dev; *(void **)data = dev;
return 1; return 1;
......
...@@ -426,7 +426,7 @@ static int mtk_iommu_add_device(struct device *dev) ...@@ -426,7 +426,7 @@ static int mtk_iommu_add_device(struct device *dev)
int err; int err;
of_for_each_phandle(&it, err, dev->of_node, "iommus", of_for_each_phandle(&it, err, dev->of_node, "iommus",
"#iommu-cells", 0) { "#iommu-cells", -1) {
int count = of_phandle_iterator_args(&it, iommu_spec.args, int count = of_phandle_iterator_args(&it, iommu_spec.args,
MAX_PHANDLE_ARGS); MAX_PHANDLE_ARGS);
iommu_spec.np = of_node_get(it.node); iommu_spec.np = of_node_get(it.node);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册