Commit 0262393c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'icc-6.16-rc5' of...

Merge tag 'icc-6.16-rc5' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/djakov/icc

 into char-misc-linus

Georgi writes:

interconnect fixes for v6.16-rc

This contains a few framework core fixes (related to the new dynamic node
id feature), as well as some misc Qualcomm and Samsung driver fixes.

- interconnect: qcom: sc7280: Add missing num_links to xm_pcie3_1 node
- interconnect: exynos: handle node name allocation failure
- interconnect: increase ICC_DYN_ID_START
- interconnect: icc-clk: destroy nodes in case of memory allocation failures
- interconnect: avoid memory allocation when 'icc_bw_lock' is held

Signed-off-by: default avatarGeorgi Djakov <djakov@kernel.org>

* tag 'icc-6.16-rc5' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
  interconnect: avoid memory allocation when 'icc_bw_lock' is held
  interconnect: icc-clk: destroy nodes in case of memory allocation failures
  interconnect: increase ICC_DYN_ID_START
  interconnect: exynos: handle node name allocation failure
  interconnect: qcom: sc7280: Add missing num_links to xm_pcie3_1 node
parents 5f596380 c5b60592
Loading
Loading
Loading
Loading
+29 −5
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include "internal.h"

#define ICC_DYN_ID_START 10000
#define ICC_DYN_ID_START 100000

#define CREATE_TRACE_POINTS
#include "trace.h"
@@ -819,6 +819,9 @@ static struct icc_node *icc_node_create_nolock(int id)
{
	struct icc_node *node;

	if (id >= ICC_DYN_ID_START)
		return ERR_PTR(-EINVAL);

	/* check if node already exists */
	node = node_find(id);
	if (node)
@@ -906,10 +909,35 @@ void icc_node_destroy(int id)
		return;

	kfree(node->links);
	if (node->id >= ICC_DYN_ID_START)
		kfree(node->name);
	kfree(node);
}
EXPORT_SYMBOL_GPL(icc_node_destroy);

/**
 * icc_node_set_name() - set node name
 * @node: node
 * @provider: node provider
 * @name: node name
 *
 * Return: 0 on success, or -ENOMEM on allocation failure
 */
int icc_node_set_name(struct icc_node *node, const struct icc_provider *provider, const char *name)
{
	if (node->id >= ICC_DYN_ID_START) {
		node->name = kasprintf(GFP_KERNEL, "%s@%s", name,
				       dev_name(provider->dev));
		if (!node->name)
			return -ENOMEM;
	} else {
		node->name = name;
	}

	return 0;
}
EXPORT_SYMBOL_GPL(icc_node_set_name);

/**
 * icc_link_nodes() - create link between two nodes
 * @src_node: source node
@@ -1038,10 +1066,6 @@ void icc_node_add(struct icc_node *node, struct icc_provider *provider)
	node->avg_bw = node->init_avg;
	node->peak_bw = node->init_peak;

	if (node->id >= ICC_DYN_ID_START)
		node->name = devm_kasprintf(provider->dev, GFP_KERNEL, "%s@%s",
					    node->name, dev_name(provider->dev));

	if (node->avg_bw || node->peak_bw) {
		if (provider->pre_aggregate)
			provider->pre_aggregate(node);
+2 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ struct icc_provider *icc_clk_register(struct device *dev,

		node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_master", data[i].name);
		if (!node->name) {
			icc_node_destroy(node->id);
			ret = -ENOMEM;
			goto err;
		}
@@ -135,6 +136,7 @@ struct icc_provider *icc_clk_register(struct device *dev,

		node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_slave", data[i].name);
		if (!node->name) {
			icc_node_destroy(node->id);
			ret = -ENOMEM;
			goto err;
		}
+6 −1
Original line number Diff line number Diff line
@@ -293,7 +293,12 @@ int qcom_icc_rpmh_probe(struct platform_device *pdev)
			goto err_remove_nodes;
		}

		node->name = qn->name;
		ret = icc_node_set_name(node, provider, qn->name);
		if (ret) {
			icc_node_destroy(node->id);
			goto err_remove_nodes;
		}

		node->data = qn;
		icc_node_add(node, provider);

+6 −1
Original line number Diff line number Diff line
@@ -236,7 +236,12 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
			goto err;
		}

		node->name = qnodes[i]->name;
		ret = icc_node_set_name(node, provider, qnodes[i]->name);
		if (ret) {
			icc_node_destroy(node->id);
			goto err;
		}

		/* Cast away const and add it back in qcom_osm_l3_set() */
		node->data = (void *)qnodes[i];
		icc_node_add(node, provider);
+1 −0
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ static struct qcom_icc_node xm_pcie3_1 = {
	.id = SC7280_MASTER_PCIE_1,
	.channels = 1,
	.buswidth = 8,
	.num_links = 1,
	.links = { SC7280_SLAVE_ANOC_PCIE_GEM_NOC },
};

Loading