[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b4fd122260aea1ba1e4e9ae655edb7d2e7e15e31.1762235099.git.charan.kalla@oss.qualcomm.com>
Date: Tue, 4 Nov 2025 14:21:00 +0530
From: Charan Teja Kalla <charan.kalla@....qualcomm.com>
To: robin.murphy@....com, will@...nel.org, joro@...tes.org, robh@...nel.org,
dmitry.baryshkov@....qualcomm.com, konrad.dybcio@....qualcomm.com,
bjorn.andersson@....qualcomm.com, bod@...nel.org, conor+dt@...nel.org,
krzk+dt@...nel.org, saravanak@...gle.com,
prakash.gupta@....qualcomm.com, vikash.garodia@....qualcomm.com
Cc: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
Charan Teja Kalla <charan.kalla@....qualcomm.com>
Subject: [PATCH 1/6] of: create a wrapper for of_map_id()
Make a new function, of_map_id_or_funcid(), which simply wraps
of_map_id(). The of_map_id_or_funcid() is improved in the subsequent
patches to parse the 'iommu-map' property based on the #iommu-cells.
No functional changes.
Signed-off-by: Charan Teja Kalla <charan.kalla@....qualcomm.com>
---
drivers/of/base.c | 52 ++++++++++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 7043acd971a0..ac6b726cd5e3 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2045,28 +2045,12 @@ int of_find_last_cache_level(unsigned int cpu)
return cache_level;
}
-/**
- * of_map_id - Translate an ID through a downstream mapping.
- * @np: root complex device node.
- * @id: device ID to map.
- * @map_name: property name of the map to use.
- * @map_mask_name: optional property name of the mask to use.
- * @target: optional pointer to a target device node.
- * @id_out: optional pointer to receive the translated ID.
- *
- * Given a device ID, look up the appropriate implementation-defined
- * platform ID and/or the target device which receives transactions on that
- * ID, as per the "iommu-map" and "msi-map" bindings. Either of @target or
- * @id_out may be NULL if only the other is required. If @target points to
- * a non-NULL device node pointer, only entries targeting that node will be
- * matched; if it points to a NULL value, it will receive the device node of
- * the first matching target phandle, with a reference held.
- *
- * Return: 0 on success or a standard error code on failure.
+/*
+ * Look at the documentation of of_map_id.
*/
-int of_map_id(const struct device_node *np, u32 id,
- const char *map_name, const char *map_mask_name,
- struct device_node **target, u32 *id_out)
+static int of_map_id_or_funcid(const struct device_node *np, u32 id,
+ const char *map_name, const char *map_mask_name,
+ struct device_node **target, u32 *id_out)
{
u32 map_mask, masked_id;
int map_len;
@@ -2149,4 +2133,30 @@ int of_map_id(const struct device_node *np, u32 id,
*id_out = id;
return 0;
}
+
+/**
+ * of_map_id - Translate an ID through a downstream mapping.
+ * @np: root complex device node.
+ * @id: device ID to map.
+ * @map_name: property name of the map to use.
+ * @map_mask_name: optional property name of the mask to use.
+ * @target: optional pointer to a target device node.
+ * @id_out: optional pointer to receive the translated ID.
+ *
+ * Given a device ID, look up the appropriate implementation-defined
+ * platform ID and/or the target device which receives transactions on that
+ * ID, as per the "iommu-map" and "msi-map" bindings. Either of @target or
+ * @id_out may be NULL if only the other is required. If @target points to
+ * a non-NULL device node pointer, only entries targeting that node will be
+ * matched; if it points to a NULL value, it will receive the device node of
+ * the first matching target phandle, with a reference held.
+ *
+ * Return: 0 on success or a standard error code on failure.
+ */
+int of_map_id(const struct device_node *np, u32 id,
+ const char *map_name, const char *map_mask_name,
+ struct device_node **target, u32 *id_out)
+{
+ return of_map_id_or_funcid(np, id, map_name, map_mask_name, target, id_out);
+}
EXPORT_SYMBOL_GPL(of_map_id);
--
2.34.1
Powered by blists - more mailing lists