summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-03-25 02:14:44 -0800
committerLinus Torvalds <torvalds@evo.osdl.org>2005-03-25 02:14:44 -0800
commit3d728f35331ece17d502fb7ab3fb402f47be42e2 (patch)
tree3f77cf42b7898db1b21499378340ff2f12003d38
parentf9de16eff75ee4e2bcff081909134e2f42ad6a59 (diff)
[PATCH] ppc64: prom.c: use pSeries reconfig notifier
Use the pSeries_reconfig notifier list to fix up a device node which is about to be added. Signed-off-by: Nathan Lynch <ntl@pobox.com> Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ppc64/kernel/prom.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index a0fae592ca1c..62a98b9af552 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -52,6 +52,7 @@
#include <asm/btext.h>
#include <asm/sections.h>
#include <asm/machdep.h>
+#include <asm/pSeries_reconfig.h>
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
@@ -1635,15 +1636,6 @@ out:
*/
void of_attach_node(struct device_node *np)
{
- int err;
-
- /* This use of finish_node will be moved to a notifier so
- * the error code can be used.
- */
- err = finish_node(np, NULL, of_finish_dynamic_node, 0, 0, 0);
- if (err < 0)
- return;
-
write_lock(&devtree_lock);
np->sibling = np->parent->child;
np->allnext = allnodes;
@@ -1690,6 +1682,36 @@ void of_detach_node(const struct device_node *np)
write_unlock(&devtree_lock);
}
+static int prom_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
+{
+ int err;
+
+ switch (action) {
+ case PSERIES_RECONFIG_ADD:
+ err = finish_node(node, NULL, of_finish_dynamic_node, 0, 0, 0);
+ if (err < 0) {
+ printk(KERN_ERR "finish_node returned %d\n", err);
+ err = NOTIFY_BAD;
+ }
+ break;
+ default:
+ err = NOTIFY_DONE;
+ break;
+ }
+ return err;
+}
+
+static struct notifier_block prom_reconfig_nb = {
+ .notifier_call prom_reconfig_notifier,
+ .priority = 10, /* This one needs to run first */
+};
+
+static int __init prom_reconfig_setup(void)
+{
+ return pSeries_reconfig_notifier_register(&prom_reconfig_nb);
+}
+__initcall(prom_reconfig_setup);
+
/*
* Find a property with a given name for a given node
* and return the value.