All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Salomon <dilinger@queued.net>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: devicetree-discuss@lists.ozlabs.org,
	Daniel Drake <dsd@laptop.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] of: remove OF_DYNAMIC config option
Date: Wed,  9 Mar 2011 16:16:05 -0800	[thread overview]
Message-ID: <1299716167-9656-2-git-send-email-dilinger@queued.net> (raw)
In-Reply-To: <1299716167-9656-1-git-send-email-dilinger@queued.net>

Make of_attach_node/of_detach_node available without a specific config option.
CONFIG_OF_DYNAMIC wasn't actually set by anything; the drivers that use
of_attach_node (in arch/powerpc/platforms/) didn't actually depend upon
or select CONFIG_OF_DYNAMIC.

While we're at it, make of_attach_node safe to call with the node's parent
being NULL; the only time this should happen is with the root node.  Later
patches will be using of_attach_node to link the root node.

Signed-off-by: Andres Salomon <dilinger@queued.net>
---
 drivers/of/Kconfig |    4 ----
 drivers/of/base.c  |   17 ++++-------------
 include/linux/of.h |    4 +---
 3 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index d06a637..ba90122 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -26,10 +26,6 @@ config OF_EARLY_FLATTREE
 config OF_PROMTREE
 	bool
 
-config OF_DYNAMIC
-	def_bool y
-	depends on PPC_OF
-
 config OF_ADDRESS
 	def_bool y
 	depends on !SPARC
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 710b53b..825e6d1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -849,15 +849,6 @@ int prom_update_property(struct device_node *np,
 	return 0;
 }
 
-#if defined(CONFIG_OF_DYNAMIC)
-/*
- * Support for dynamic device trees.
- *
- * On some platforms, the device tree can be manipulated at runtime.
- * The routines in this section support adding, removing and changing
- * device tree nodes.
- */
-
 /**
  * of_attach_node - Plug a device node into the tree and global list.
  */
@@ -866,9 +857,11 @@ void of_attach_node(struct device_node *np)
 	unsigned long flags;
 
 	write_lock_irqsave(&devtree_lock, flags);
-	np->sibling = np->parent->child;
+	if (np->parent) {
+		np->sibling = np->parent->child;
+		np->parent->child = np;
+	}
 	np->allnext = allnodes;
-	np->parent->child = np;
 	allnodes = np;
 	write_unlock_irqrestore(&devtree_lock, flags);
 }
@@ -917,5 +910,3 @@ void of_detach_node(struct device_node *np)
 out_unlock:
 	write_unlock_irqrestore(&devtree_lock, flags);
 }
-#endif /* defined(CONFIG_OF_DYNAMIC) */
-
diff --git a/include/linux/of.h b/include/linux/of.h
index bfc0ed1..bb36473 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -221,11 +221,9 @@ extern int prom_update_property(struct device_node *np,
 				struct property *newprop,
 				struct property *oldprop);
 
-#if defined(CONFIG_OF_DYNAMIC)
-/* For updating the device tree at runtime */
+/* For updating the device tree */
 extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
-#endif
 
 #else
 
-- 
1.7.2.3


WARNING: multiple messages have this Message-ID (diff)
From: Andres Salomon <dilinger-pFFUokh25LWsTnJN9+BGXg@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Daniel Drake <dsd-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/3] of: remove OF_DYNAMIC config option
Date: Wed,  9 Mar 2011 16:16:05 -0800	[thread overview]
Message-ID: <1299716167-9656-2-git-send-email-dilinger@queued.net> (raw)
In-Reply-To: <1299716167-9656-1-git-send-email-dilinger-pFFUokh25LWsTnJN9+BGXg@public.gmane.org>

Make of_attach_node/of_detach_node available without a specific config option.
CONFIG_OF_DYNAMIC wasn't actually set by anything; the drivers that use
of_attach_node (in arch/powerpc/platforms/) didn't actually depend upon
or select CONFIG_OF_DYNAMIC.

While we're at it, make of_attach_node safe to call with the node's parent
being NULL; the only time this should happen is with the root node.  Later
patches will be using of_attach_node to link the root node.

Signed-off-by: Andres Salomon <dilinger-pFFUokh25LWsTnJN9+BGXg@public.gmane.org>
---
 drivers/of/Kconfig |    4 ----
 drivers/of/base.c  |   17 ++++-------------
 include/linux/of.h |    4 +---
 3 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index d06a637..ba90122 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -26,10 +26,6 @@ config OF_EARLY_FLATTREE
 config OF_PROMTREE
 	bool
 
-config OF_DYNAMIC
-	def_bool y
-	depends on PPC_OF
-
 config OF_ADDRESS
 	def_bool y
 	depends on !SPARC
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 710b53b..825e6d1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -849,15 +849,6 @@ int prom_update_property(struct device_node *np,
 	return 0;
 }
 
-#if defined(CONFIG_OF_DYNAMIC)
-/*
- * Support for dynamic device trees.
- *
- * On some platforms, the device tree can be manipulated at runtime.
- * The routines in this section support adding, removing and changing
- * device tree nodes.
- */
-
 /**
  * of_attach_node - Plug a device node into the tree and global list.
  */
@@ -866,9 +857,11 @@ void of_attach_node(struct device_node *np)
 	unsigned long flags;
 
 	write_lock_irqsave(&devtree_lock, flags);
-	np->sibling = np->parent->child;
+	if (np->parent) {
+		np->sibling = np->parent->child;
+		np->parent->child = np;
+	}
 	np->allnext = allnodes;
-	np->parent->child = np;
 	allnodes = np;
 	write_unlock_irqrestore(&devtree_lock, flags);
 }
@@ -917,5 +910,3 @@ void of_detach_node(struct device_node *np)
 out_unlock:
 	write_unlock_irqrestore(&devtree_lock, flags);
 }
-#endif /* defined(CONFIG_OF_DYNAMIC) */
-
diff --git a/include/linux/of.h b/include/linux/of.h
index bfc0ed1..bb36473 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -221,11 +221,9 @@ extern int prom_update_property(struct device_node *np,
 				struct property *newprop,
 				struct property *oldprop);
 
-#if defined(CONFIG_OF_DYNAMIC)
-/* For updating the device tree at runtime */
+/* For updating the device tree */
 extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
-#endif
 
 #else
 
-- 
1.7.2.3

  reply	other threads:[~2011-03-10  0:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10  0:16 [PATCH 0/3] switch DT creation to using of_attach_node Andres Salomon
2011-03-10  0:16 ` Andres Salomon
2011-03-10  0:16 ` Andres Salomon [this message]
2011-03-10  0:16   ` [PATCH 1/3] of: remove OF_DYNAMIC config option Andres Salomon
2011-03-12  9:00   ` Grant Likely
2011-03-12  9:00     ` Grant Likely
     [not found] ` <1299716167-9656-1-git-send-email-dilinger-pFFUokh25LWsTnJN9+BGXg@public.gmane.org>
2011-03-10  0:16   ` [PATCH 2/3] of/promtree: switch to building the DT using of_attach_node Andres Salomon
2011-03-10  0:16     ` Andres Salomon
2011-03-10  0:16     ` Andres Salomon
2011-03-12  9:00     ` [PATCH 2/3] of/promtree: switch to building the DT using Grant Likely
2011-03-12  9:00       ` [PATCH 2/3] of/promtree: switch to building the DT using of_attach_node Grant Likely
2011-03-10  0:16 ` [PATCH 3/3] of/flattree: use of_attach_node to build tree, and associated cleanups Andres Salomon
2011-03-12  9:10   ` Grant Likely
2011-03-12  9:10     ` Grant Likely
2011-03-12 19:37     ` Andres Salomon
2011-03-12 19:37       ` Andres Salomon
2011-03-15  3:34       ` Grant Likely
2011-03-15  3:34         ` Grant Likely

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=1299716167-9656-2-git-send-email-dilinger@queued.net \
    --to=dilinger@queued.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=dsd@laptop.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.