[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240228062138.1275542-1-peng.fan@oss.nxp.com>
Date: Wed, 28 Feb 2024 14:21:38 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: robh@...nel.org,
saravanak@...gle.com,
bhelgaas@...gle.com,
pali@...nel.org
Cc: devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Peng Fan <peng.fan@....com>
Subject: [PATCH] of: dynamic: notify before revert
From: Peng Fan <peng.fan@....com>
When PCI node was created using an overlay and the overlay is
reverted/destroyed, the "linux,pci-domain" property no longer
exists, so of_get_pci_domain_nr will return failure. Then
of_pci_bus_release_domain_nr will actually use the dynamic IDA,
even if the IDA was allocated in static IDA.
So move the notify before revert to fix the issue.
Fixes: c14f7ccc9f5d ("PCI: Assign PCI domain IDs by ida_alloc()")
Signed-off-by: Peng Fan <peng.fan@....com>
---
The initial thread:
https://lore.kernel.org/all/20230913115737.GA426735@bhelgaas/
drivers/of/dynamic.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 3bf27052832f..0a5ec2bda380 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -834,13 +834,15 @@ int __of_changeset_revert_notify(struct of_changeset *ocs)
static int __of_changeset_revert(struct of_changeset *ocs)
{
- int ret, ret_reply;
+ int ret, ret_reply = 0;
- ret_reply = 0;
- ret = __of_changeset_revert_entries(ocs, &ret_reply);
+ ret = __of_changeset_revert_notify(ocs);
+ if (ret)
+ return ret;
- if (!ret)
- ret = __of_changeset_revert_notify(ocs);
+ ret = __of_changeset_revert_entries(ocs, &ret_reply);
+ if (ret && !ret_reply)
+ ret = __of_changeset_apply_notify(ocs);
return ret;
}
--
2.37.1
Powered by blists - more mailing lists