提交 05309830 编写于 作者: G Georgi Djakov

interconnect: Add a name to struct icc_path

When debugging interconnect things, it turned out that saving the path
name and including it in the traces is quite useful, especially for
devices with multiple paths.

For the path name we use the one specified in DT, or if we use platform
data, the name is based on the source and destination node names.
Suggested-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: NGeorgi Djakov <georgi.djakov@linaro.org>
上级 dd018a9c
...@@ -356,9 +356,17 @@ struct icc_path *of_icc_get(struct device *dev, const char *name) ...@@ -356,9 +356,17 @@ struct icc_path *of_icc_get(struct device *dev, const char *name)
mutex_lock(&icc_lock); mutex_lock(&icc_lock);
path = path_find(dev, src_node, dst_node); path = path_find(dev, src_node, dst_node);
if (IS_ERR(path))
dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
mutex_unlock(&icc_lock); mutex_unlock(&icc_lock);
if (IS_ERR(path)) {
dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
return path;
}
if (name)
path->name = kstrdup_const(name, GFP_KERNEL);
else
path->name = kasprintf(GFP_KERNEL, "%s-%s",
src_node->name, dst_node->name);
return path; return path;
} }
...@@ -481,9 +489,12 @@ struct icc_path *icc_get(struct device *dev, const int src_id, const int dst_id) ...@@ -481,9 +489,12 @@ struct icc_path *icc_get(struct device *dev, const int src_id, const int dst_id)
goto out; goto out;
path = path_find(dev, src, dst); path = path_find(dev, src, dst);
if (IS_ERR(path)) if (IS_ERR(path)) {
dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path));
goto out;
}
path->name = kasprintf(GFP_KERNEL, "%s-%s", src->name, dst->name);
out: out:
mutex_unlock(&icc_lock); mutex_unlock(&icc_lock);
return path; return path;
...@@ -519,6 +530,7 @@ void icc_put(struct icc_path *path) ...@@ -519,6 +530,7 @@ void icc_put(struct icc_path *path)
} }
mutex_unlock(&icc_lock); mutex_unlock(&icc_lock);
kfree_const(path->name);
kfree(path); kfree(path);
} }
EXPORT_SYMBOL_GPL(icc_put); EXPORT_SYMBOL_GPL(icc_put);
......
...@@ -29,10 +29,12 @@ struct icc_req { ...@@ -29,10 +29,12 @@ struct icc_req {
/** /**
* struct icc_path - interconnect path structure * struct icc_path - interconnect path structure
* @name: a string name of the path (useful for ftrace)
* @num_nodes: number of hops (nodes) * @num_nodes: number of hops (nodes)
* @reqs: array of the requests applicable to this path of nodes * @reqs: array of the requests applicable to this path of nodes
*/ */
struct icc_path { struct icc_path {
const char *name;
size_t num_nodes; size_t num_nodes;
struct icc_req reqs[]; struct icc_req reqs[];
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册