lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1299716167-9656-2-git-send-email-dilinger@queued.net>
Date:	Wed,  9 Mar 2011 16:16:05 -0800
From:	Andres Salomon <dilinger@...ued.net>
To:	Grant Likely <grant.likely@...retlab.ca>
Cc:	devicetree-discuss@...ts.ozlabs.org, Daniel Drake <dsd@...top.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] of: remove OF_DYNAMIC config option

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@...ued.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ