iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] iommu: pass cell_count = -1 to of_for_each_phandle with cells_name
@ 2019-08-24 13:28 Uwe Kleine-König
  2019-08-24 13:28 ` [PATCH v1 2/2] of: Let of_for_each_phandle fallback to non-negative cell_count Uwe Kleine-König
  2019-09-03 12:52 ` [PATCH v1 1/2] iommu: pass cell_count = -1 to of_for_each_phandle with cells_name Joerg Roedel
  0 siblings, 2 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2019-08-24 13:28 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand, Will Deacon, Robin Murphy,
	Joerg Roedel, Matthias Brugger
  Cc: devicetree, linux-kernel, iommu, linux-mediatek, kernel,
	linux-arm-kernel

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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iommu/arm-smmu.c     | 2 +-
 drivers/iommu/mtk_iommu_v1.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 64977c131ee6..81b7734654b3 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -333,7 +333,7 @@ static int __find_legacy_master_phandle(struct device *dev, void *data)
 	int err;
 
 	of_for_each_phandle(it, err, dev->of_node, "mmu-masters",
-			    "#stream-id-cells", 0)
+			    "#stream-id-cells", -1)
 		if (it->node == np) {
 			*(void **)data = dev;
 			return 1;
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index abeeac488372..68d1de70de0c 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -426,7 +426,7 @@ static int mtk_iommu_add_device(struct device *dev)
 	int err;
 
 	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,
 					MAX_PHANDLE_ARGS);
 		iommu_spec.np = of_node_get(it.node);
-- 
2.20.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-17 12:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 13:28 [PATCH v1 1/2] iommu: pass cell_count = -1 to of_for_each_phandle with cells_name Uwe Kleine-König
2019-08-24 13:28 ` [PATCH v1 2/2] of: Let of_for_each_phandle fallback to non-negative cell_count Uwe Kleine-König
2019-09-02 14:26   ` Rob Herring
2019-09-13 21:58   ` Rob Herring
2019-09-17  9:40     ` Geert Uytterhoeven
2019-09-17 10:13       ` Uwe Kleine-König
2019-09-17 11:25         ` Peter Rosin
2019-09-17 12:25           ` Uwe Kleine-König
     [not found]             ` <CGME20190917124409eucas1p2211d232e6833a44a9ad5dbf72457197c@eucas1p2.samsung.com>
2019-09-17 12:44               ` Marek Szyprowski
2019-09-17 12:52             ` Geert Uytterhoeven
2019-09-03 12:52 ` [PATCH v1 1/2] iommu: pass cell_count = -1 to of_for_each_phandle with cells_name Joerg Roedel
2019-09-12  7:43   ` Uwe Kleine-König
2019-09-13  7:37     ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).