]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/powerpc/platforms/pseries/reconfig.c
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / platforms / pseries / reconfig.c
index 2f4668136b200d9f22a25c7761749e7e512b315f..d6491bd481d0cef934cf9873a0b014d28c7a25ac 100644 (file)
 #include <linux/notifier.h>
 #include <linux/proc_fs.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/uaccess.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/mmu.h>
 
-
-
-/*
- * Routines for "runtime" addition and removal of device tree nodes.
- */
-#ifdef CONFIG_PROC_DEVICETREE
-/*
- * Add a node to /proc/device-tree.
- */
-static void add_node_proc_entries(struct device_node *np)
-{
-       struct proc_dir_entry *ent;
-
-       ent = proc_mkdir(strrchr(np->full_name, '/') + 1, np->parent->pde);
-       if (ent)
-               proc_device_tree_add_node(np, ent);
-}
-
-static void remove_node_proc_entries(struct device_node *np)
-{
-       struct property *pp = np->properties;
-       struct device_node *parent = np->parent;
-
-       while (pp) {
-               remove_proc_entry(pp->name, np->pde);
-               pp = pp->next;
-       }
-       if (np->pde)
-               remove_proc_entry(np->pde->name, parent->pde);
-}
-#else /* !CONFIG_PROC_DEVICETREE */
-static void add_node_proc_entries(struct device_node *np)
-{
-       return;
-}
-
-static void remove_node_proc_entries(struct device_node *np)
-{
-       return;
-}
-#endif /* CONFIG_PROC_DEVICETREE */
-
 /**
  *     derive_parent - basically like dirname(1)
  *     @path:  the full_name of a node to be added to the tree
@@ -97,28 +55,6 @@ static struct device_node *derive_parent(const char *path)
        return parent;
 }
 
-static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
-
-int pSeries_reconfig_notifier_register(struct notifier_block *nb)
-{
-       return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
-}
-EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_register);
-
-void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
-{
-       blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
-}
-EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_unregister);
-
-int pSeries_reconfig_notify(unsigned long action, void *p)
-{
-       int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
-                                               action, p);
-
-       return notifier_to_errno(err);
-}
-
 static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
 {
        struct device_node *np;
@@ -142,16 +78,12 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
                goto out_err;
        }
 
-       err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
+       err = of_attach_node(np);
        if (err) {
                printk(KERN_ERR "Failed to add device node %s\n", path);
                goto out_err;
        }
 
-       of_attach_node(np);
-
-       add_node_proc_entries(np);
-
        of_node_put(np->parent);
 
        return 0;
@@ -179,11 +111,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
                return -EBUSY;
        }
 
-       remove_node_proc_entries(np);
-
-       pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
        of_detach_node(np);
-
        of_node_put(parent);
        of_node_put(np); /* Must decrement the refcount */
        return 0;
@@ -397,7 +325,7 @@ static int do_add_property(char *buf, size_t bufsize)
        if (!prop)
                return -ENOMEM;
 
-       prom_add_property(np, prop);
+       of_add_property(np, prop);
 
        return 0;
 }
@@ -421,16 +349,15 @@ static int do_remove_property(char *buf, size_t bufsize)
 
        prop = of_find_property(np, buf, NULL);
 
-       return prom_remove_property(np, prop);
+       return of_remove_property(np, prop);
 }
 
 static int do_update_property(char *buf, size_t bufsize)
 {
        struct device_node *np;
-       struct pSeries_reconfig_prop_update upd_value;
        unsigned char *value;
        char *name, *end, *next_prop;
-       int rc, length;
+       int length;
        struct property *newprop;
        buf = parse_node(buf, bufsize, &np);
        end = buf + bufsize;
@@ -452,41 +379,7 @@ static int do_update_property(char *buf, size_t bufsize)
        if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size"))
                slb_set_size(*(int *)value);
 
-       upd_value.node = np;
-       upd_value.property = newprop;
-       pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value);
-
-       rc = prom_update_property(np, newprop);
-       if (rc)
-               return rc;
-
-       /* For memory under the ibm,dynamic-reconfiguration-memory node
-        * of the device tree, adding and removing memory is just an update
-        * to the ibm,dynamic-memory property instead of adding/removing a
-        * memory node in the device tree.  For these cases we still need to
-        * involve the notifier chain.
-        */
-       if (!strcmp(name, "ibm,dynamic-memory")) {
-               int action;
-
-               next_prop = parse_next_property(next_prop, end, &name,
-                                               &length, &value);
-               if (!next_prop)
-                       return -EINVAL;
-
-               if (!strcmp(name, "add"))
-                       action = PSERIES_DRCONF_MEM_ADD;
-               else
-                       action = PSERIES_DRCONF_MEM_REMOVE;
-
-               rc = pSeries_reconfig_notify(action, value);
-               if (rc) {
-                       prom_update_property(np, newprop);
-                       return rc;
-               }
-       }
-
-       return 0;
+       return of_update_property(np, newprop);
 }
 
 /**