Skip to contentSkip to conversation

FAILED: patch "[PATCH] pmdomain: ti-sci: Fix duplicate PD referrals" failed to apply to 5.10-stable tree

PATCH [email protected] 1 participant 1 message Jun 19, 2024

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 670c900f69645db394efb38934b3344d8804171a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024061904-headache-underfeed-cd85@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

670c900f6964 ("pmdomain: ti-sci: Fix duplicate PD referrals")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 670c900f69645db394efb38934b3344d8804171a Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <[email protected]>
Date: Mon, 15 Apr 2024 19:00:23 +0300
Subject: [PATCH] pmdomain: ti-sci: Fix duplicate PD referrals

When the dts file has multiple referrers to a single PD (e.g. simple-framebuffer and dss nodes both point to the DSS power-domain) the ti-sci driver will create two power domains, both with the same ID, and that will cause problems as one of the power domains will hide the other one.

Fix this checking if a PD with the ID has already been created, and only create a PD for new IDs.

Fixes efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one")
drivers/pmdomain/ti/ti_sci_pm_domains.c +19 -1
index 9dddf227a3a6..1510d5ddae3d 100644
@@ -114,6 +114,18 @@ static const struct of_device_id ti_sci_pm_domain_matches[] = {
 };
 MODULE_DEVICE_TABLE(of, ti_sci_pm_domain_matches);
 
+static bool ti_sci_pm_idx_exists(struct ti_sci_genpd_provider *pd_provider, u32 idx)
+{
+	struct ti_sci_pm_domain *pd;
+
+	list_for_each_entry(pd, &pd_provider->pd_list, node) {
+		if (pd->idx == idx)
+			return true;
+	}
+
+	return false;
+}
+
 static int ti_sci_pm_domain_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -149,8 +161,14 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
 				break;
 
 			if (args.args_count >= 1 && args.np == dev->of_node) {
-				if (args.args[0] > max_id)
+				if (args.args[0] > max_id) {
 					max_id = args.args[0];
+				} else {
+					if (ti_sci_pm_idx_exists(pd_provider, args.args[0])) {
+						index++;
+						continue;
+					}
+				}
 
 				pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
 				if (!pd) {