From: Haren Myneni <haren@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: devicetree@vger.kernel.org, maddy@linux.ibm.com, robh@kernel.org,
mpe@ellerman.id.au, npiggin@gmail.com, saravanak@kernel.org,
ritesh.list@gmail.com, hbabu@us.ibm.com, haren@linux.ibm.com
Subject: [PATCH 1/2] drivers/of: Add of_detach_node_no_notify()
Date: Tue, 15 Sep 2026 21:32:48 -0700 [thread overview]
Message-ID: <20260916043249.2062676-1-haren@linux.ibm.com> (raw)
of_changeset_apply() interface adds nodes for action
OF_RECONFIG_ATTACH_NODE and calls notifiers for each attached node.
Then the caller uses of_detach_node() to release each node and
also calls the corresponding notifier function. In the case of
failure from the add notifier for any node, of_changeset_apply()
returns failure after adding nodes. The current implementation
does not the provide any interface to the caller to remove nodes
from the DT without calling notifiers. It may end up having nodes
in DT even though ADD is not successful.
This patch introduces of_detach_node_no_notify() interface for the
caller to only remove node if it is not attached.
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
---
drivers/of/dynamic.c | 16 ++++++++++++++++
include/linux/of.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 744ce0e1eb24..fc6f22371a97 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -318,6 +318,22 @@ int of_detach_node(struct device_node *np)
}
EXPORT_SYMBOL_GPL(of_detach_node);
+/**
+ * of_detach_node_no_notify() - "Unplug" a node from the device
+ * and return without running notifiers.
+ * @np: Pointer to the caller's Device Node
+ */
+int of_detach_node_no_notify(struct device_node *np)
+{
+ mutex_lock(&of_mutex);
+ if (!of_node_check_flag(np, OF_DETACHED))
+ __of_detach_node(np);
+ mutex_unlock(&of_mutex);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_detach_node_no_notify);
+
void __of_prop_free(struct property *prop)
{
kfree(prop->name);
diff --git a/include/linux/of.h b/include/linux/of.h
index b920aac6b975..7a509341e998 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -442,6 +442,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop);
extern int of_attach_node(struct device_node *);
extern int of_detach_node(struct device_node *);
+extern int of_detach_node_no_notify(struct device_node *);
#define of_match_ptr(_ptr) (_ptr)
--
2.55.0
next reply other threads:[~2026-09-16 4:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 4:32 Haren Myneni [this message]
2026-09-16 4:32 ` [PATCH 2/2] powerpc/pseries/dlpar: Remove DT entries if failure from CPU ADD notifier Haren Myneni
2026-09-16 4:47 ` sashiko-bot
2026-09-17 3:57 ` Haren Myneni
2026-09-16 21:33 ` Rob Herring
2026-09-17 3:42 ` Haren Myneni
2026-09-16 4:43 ` [PATCH 1/2] drivers/of: Add of_detach_node_no_notify() sashiko-bot
2026-09-17 4:11 ` Haren Myneni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916043249.2062676-1-haren@linux.ibm.com \
--to=haren@linux.ibm.com \
--cc=devicetree@vger.kernel.org \
--cc=hbabu@us.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox