linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Move some OF functionality from pseries to generic OF code
@ 2012-10-02 18:11 Nathan Fontenot
  2012-10-03  2:55 ` [PATCH 1/5] Add /proc device tree updating to of node add/remove Nathan Fontenot
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Nathan Fontenot @ 2012-10-02 18:11 UTC (permalink / raw)
  To: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

This set of patches moves some OF code that has been living
in the pseries tree over to the generic OF code base. The
functionality being migrated over is something that, I believe,
should live in the generic code base. The specific functionality
being migrated to generic OF code is;

o Updating the device tree in /proc when adding/removing a node.
o Adding a notification chain for adding/removing nodes and
  properties of the device tree.
o Re-naming the base OF code prom_* routines to of_* to better go
  with the naming used for OF code.

-Nathan 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] Add /proc device tree updating to of node add/remove
  2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
@ 2012-10-03  2:55 ` Nathan Fontenot
  2012-11-14 14:38   ` Grant Likely
  2012-10-03  2:56 ` [PATCH 2/5] Move of_drconf_cell struct definition to asm/prom.h Nathan Fontenot
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Nathan Fontenot @ 2012-10-03  2:55 UTC (permalink / raw)
  To: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

When adding or removing a device tree node we should also update
the device tree in /proc/device-tree. This action is already done in the
generic OF code for adding/removing properties of a node. This patch adds
this functionality for nodes.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> 
---
 arch/powerpc/platforms/pseries/dlpar.c    |   24 -------------
 arch/powerpc/platforms/pseries/reconfig.c |   47 -------------------------
 drivers/of/base.c                         |   55 +++++++++++++++++++++++++++---
 3 files changed, 51 insertions(+), 75 deletions(-)

Index: dt-next/arch/powerpc/platforms/pseries/dlpar.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/dlpar.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/dlpar.c	2012-10-02 08:40:51.000000000 -0500
@@ -13,7 +13,6 @@
 #include <linux/kernel.h>
 #include <linux/kref.h>
 #include <linux/notifier.h>
-#include <linux/proc_fs.h>
 #include <linux/spinlock.h>
 #include <linux/cpu.h>
 #include <linux/slab.h>
@@ -255,9 +254,6 @@
 
 int dlpar_attach_node(struct device_node *dn)
 {
-#ifdef CONFIG_PROC_DEVICETREE
-	struct proc_dir_entry *ent;
-#endif
 	int rc;
 
 	of_node_set_flag(dn, OF_DYNAMIC);
@@ -274,32 +270,12 @@
 	}
 
 	of_attach_node(dn);
-
-#ifdef CONFIG_PROC_DEVICETREE
-	ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
-	if (ent)
-		proc_device_tree_add_node(dn, ent);
-#endif
-
 	of_node_put(dn->parent);
 	return 0;
 }
 
 int dlpar_detach_node(struct device_node *dn)
 {
-#ifdef CONFIG_PROC_DEVICETREE
-	struct device_node *parent = dn->parent;
-	struct property *prop = dn->properties;
-
-	while (prop) {
-		remove_proc_entry(prop->name, dn->pde);
-		prop = prop->next;
-	}
-
-	if (dn->pde)
-		remove_proc_entry(dn->pde->name, parent->pde);
-#endif
-
 	pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
 	of_detach_node(dn);
 	of_node_put(dn); /* Must decrement the refcount */
Index: dt-next/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/reconfig.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/reconfig.c	2012-10-02 08:40:51.000000000 -0500
@@ -23,48 +23,6 @@
 #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
@@ -149,9 +107,6 @@
 	}
 
 	of_attach_node(np);
-
-	add_node_proc_entries(np);
-
 	of_node_put(np->parent);
 
 	return 0;
@@ -179,8 +134,6 @@
 		return -EBUSY;
 	}
 
-	remove_node_proc_entries(np);
-
 	pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
 	of_detach_node(np);
 
Index: dt-next/drivers/of/base.c
===================================================================
--- dt-next.orig/drivers/of/base.c	2012-10-02 08:30:47.000000000 -0500
+++ dt-next/drivers/of/base.c	2012-10-02 08:40:51.000000000 -0500
@@ -1103,6 +1103,22 @@
  * device tree nodes.
  */
 
+#ifdef CONFIG_PROC_DEVICETREE
+static void of_add_proc_dt_entry(struct device_node *dn)
+{
+	struct proc_dir_entry *ent;
+
+	ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
+	if (ent)
+		proc_device_tree_add_node(dn, ent);
+}
+#else
+static void of_add_proc_dt_entry(struct device_node *dn)
+{
+	return;
+}
+#endif
+
 /**
  * of_attach_node - Plug a device node into the tree and global list.
  */
@@ -1116,7 +1132,30 @@
 	np->parent->child = np;
 	allnodes = np;
 	write_unlock_irqrestore(&devtree_lock, flags);
+
+	of_add_proc_dt_entry(np);
+}
+
+#ifdef CONFIG_PROC_DEVICETREE
+static void of_remove_proc_dt_entry(struct device_node *dn)
+{
+	struct device_node *parent = dn->parent;
+	struct property *prop = dn->properties;
+
+	while (prop) {
+		remove_proc_entry(prop->name, dn->pde);
+		prop = prop->next;
+	}
+
+	if (dn->pde)
+		remove_proc_entry(dn->pde->name, parent->pde);
+}
+#else
+static void of_remove_proc_dt_entry(struct device_node *dn)
+{
+	return;
 }
+#endif
 
 /**
  * of_detach_node - "Unplug" a node from the device tree.
@@ -1131,9 +1170,17 @@
 
 	write_lock_irqsave(&devtree_lock, flags);
 
+	if (of_node_check_flag(np, OF_DETACHED)) {
+		/* someone already detached it */
+		write_unlock_irqrestore(&devtree_lock, flags);
+		return;
+	}
+
 	parent = np->parent;
-	if (!parent)
-		goto out_unlock;
+	if (!parent) {
+		write_unlock_irqrestore(&devtree_lock, flags);
+		return;
+	}
 
 	if (allnodes == np)
 		allnodes = np->allnext;
@@ -1158,9 +1205,9 @@
 	}
 
 	of_node_set_flag(np, OF_DETACHED);
-
-out_unlock:
 	write_unlock_irqrestore(&devtree_lock, flags);
+
+	of_remove_proc_dt_entry(np);
 }
 #endif /* defined(CONFIG_OF_DYNAMIC) */


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/5] Move of_drconf_cell struct definition to asm/prom.h
  2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
  2012-10-03  2:55 ` [PATCH 1/5] Add /proc device tree updating to of node add/remove Nathan Fontenot
@ 2012-10-03  2:56 ` Nathan Fontenot
  2012-10-03  2:57 ` [PATCH 3/5] Add of node/property notification chain for adds and removes Nathan Fontenot
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Nathan Fontenot @ 2012-10-03  2:56 UTC (permalink / raw)
  To: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

This patch moves the definition of the of_drconf_cell struct to asm/prom.h 
to make it available for all powerpc/pseries code.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

---
 arch/powerpc/include/asm/prom.h |   16 ++++++++++++++++
 arch/powerpc/mm/numa.c          |   12 ------------
 2 files changed, 16 insertions(+), 12 deletions(-)

Index: dt-next/arch/powerpc/mm/numa.c
===================================================================
--- dt-next.orig/arch/powerpc/mm/numa.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/mm/numa.c	2012-10-02 08:41:42.000000000 -0500
@@ -397,18 +397,6 @@
 	return result;
 }
 
-struct of_drconf_cell {
-	u64	base_addr;
-	u32	drc_index;
-	u32	reserved;
-	u32	aa_index;
-	u32	flags;
-};
-
-#define DRCONF_MEM_ASSIGNED	0x00000008
-#define DRCONF_MEM_AI_INVALID	0x00000040
-#define DRCONF_MEM_RESERVED	0x00000080
-
 /*
  * Read the next memblock list entry from the ibm,dynamic-memory property
  * and return the information in the provided of_drconf_cell structure.
Index: dt-next/arch/powerpc/include/asm/prom.h
===================================================================
--- dt-next.orig/arch/powerpc/include/asm/prom.h	2011-11-17 09:12:07.000000000 -0600
+++ dt-next/arch/powerpc/include/asm/prom.h	2012-10-02 08:41:42.000000000 -0500
@@ -58,6 +58,22 @@
 
 extern void of_instantiate_rtc(void);
 
+/* The of_drconf_cell struct defines the layout of the LMB array
+ * specified in the device tree property
+ * ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory
+ */
+struct of_drconf_cell {
+	u64	base_addr;
+	u32	drc_index;
+	u32	reserved;
+	u32	aa_index;
+	u32	flags;
+};
+
+#define DRCONF_MEM_ASSIGNED	0x00000008
+#define DRCONF_MEM_AI_INVALID	0x00000040
+#define DRCONF_MEM_RESERVED	0x00000080
+
 /* These includes are put at the bottom because they may contain things
  * that are overridden by this file.  Ideally they shouldn't be included
  * by this file, but there are a bunch of .c files that currently depend


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/5] Add of node/property notification chain for adds and removes
  2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
  2012-10-03  2:55 ` [PATCH 1/5] Add /proc device tree updating to of node add/remove Nathan Fontenot
  2012-10-03  2:56 ` [PATCH 2/5] Move of_drconf_cell struct definition to asm/prom.h Nathan Fontenot
@ 2012-10-03  2:57 ` Nathan Fontenot
  2012-10-03  2:58 ` [PATCH 4/5] Rename the drivers/of prom_* functions to of_* Nathan Fontenot
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Nathan Fontenot @ 2012-10-03  2:57 UTC (permalink / raw)
  To: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

This patch moves the notification chain for updates to the device tree
from the powerpc/pseries code to the base OF code. This makes this
functionality available to all architectures.

Additionally the notification chain is updated to allow notifications
for property add/remove/update. To make this work a pointer to a new
struct (of_prop_reconfig) is passed to the routines in the notification chain.
The of_prop_reconfig property contains a pointer to the node containing the
property and a pointer to the property itself. In the case of property
updates, the property pointer refers to the new property.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pSeries_reconfig.h     |   32 ----------
 arch/powerpc/kernel/prom.c                      |    6 -
 arch/powerpc/platforms/pseries/dlpar.c          |   14 ++--
 arch/powerpc/platforms/pseries/hotplug-cpu.c    |    8 +-
 arch/powerpc/platforms/pseries/hotplug-memory.c |   60 +++++++++++++------
 arch/powerpc/platforms/pseries/iommu.c          |    6 -
 arch/powerpc/platforms/pseries/reconfig.c       |   65 ---------------------
 arch/powerpc/platforms/pseries/setup.c          |    6 -
 drivers/of/base.c                               |   74 ++++++++++++++++++++++--
 include/linux/of.h                              |   20 +++++-
 10 files changed, 154 insertions(+), 137 deletions(-)

Index: dt-next/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/reconfig.c	2012-10-02 08:40:51.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/reconfig.c	2012-10-02 08:45:12.000000000 -0500
@@ -16,11 +16,11 @@
 #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>
 
 /**
@@ -55,28 +55,6 @@
 	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;
@@ -100,13 +78,12 @@
 		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);
 	of_node_put(np->parent);
 
 	return 0;
@@ -134,9 +111,7 @@
 		return -EBUSY;
 	}
 
-	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;
@@ -381,7 +356,6 @@
 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;
@@ -410,41 +384,8 @@
 		return -ENODEV;
 	}
 
-	upd_value.node = np;
-	upd_value.property = newprop;
-	pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value);
-
 	rc = prom_update_property(np, newprop, oldprop);
-	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, oldprop, newprop);
-			return rc;
-		}
-	}
-
-	return 0;
+	return rc;
 }
 
 /**
Index: dt-next/drivers/of/base.c
===================================================================
--- dt-next.orig/drivers/of/base.c	2012-10-02 08:40:51.000000000 -0500
+++ dt-next/drivers/of/base.c	2012-10-02 08:58:55.000000000 -0500
@@ -978,6 +978,24 @@
 }
 EXPORT_SYMBOL(of_parse_phandle_with_args);
 
+#if defined(CONFIG_OF_DYNAMIC)
+static int of_property_notify(int action, struct device_node *np,
+			      struct property *prop)
+{
+	struct of_prop_reconfig pr;
+
+	pr.dn = np;
+	pr.prop = prop;
+	return of_reconfig_notify(action, &pr);
+}
+#else
+static int of_property_notify(int action, struct device_node *np,
+			      struct property *prop)
+{
+	return 0;
+}
+#endif
+
 /**
  * prom_add_property - Add a property to a node
  */
@@ -985,6 +1003,11 @@
 {
 	struct property **next;
 	unsigned long flags;
+	int rc;
+
+	rc = of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop);
+	if (rc)
+		return rc;
 
 	prop->next = NULL;
 	write_lock_irqsave(&devtree_lock, flags);
@@ -1022,6 +1045,11 @@
 	struct property **next;
 	unsigned long flags;
 	int found = 0;
+	int rc;
+
+	rc = of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop);
+	if (rc)
+		return rc;
 
 	write_lock_irqsave(&devtree_lock, flags);
 	next = &np->properties;
@@ -1064,7 +1092,11 @@
 {
 	struct property **next;
 	unsigned long flags;
-	int found = 0;
+	int rc, found = 0;
+
+	rc = of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop);
+	if (rc)
+		return rc;
 
 	write_lock_irqsave(&devtree_lock, flags);
 	next = &np->properties;
@@ -1103,6 +1135,26 @@
  * device tree nodes.
  */
 
+static BLOCKING_NOTIFIER_HEAD(of_reconfig_chain);
+
+int of_reconfig_notifier_register(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&of_reconfig_chain, nb);
+}
+
+int of_reconfig_notifier_unregister(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&of_reconfig_chain, nb);
+}
+
+int of_reconfig_notify(unsigned long action, void *p)
+{
+	int rc;
+
+	rc = blocking_notifier_call_chain(&of_reconfig_chain, action, p);
+	return notifier_to_errno(rc);
+}
+
 #ifdef CONFIG_PROC_DEVICETREE
 static void of_add_proc_dt_entry(struct device_node *dn)
 {
@@ -1122,9 +1174,14 @@
 /**
  * of_attach_node - Plug a device node into the tree and global list.
  */
-void of_attach_node(struct device_node *np)
+int of_attach_node(struct device_node *np)
 {
 	unsigned long flags;
+	int rc;
+
+	rc = of_reconfig_notify(OF_RECONFIG_ATTACH_NODE, np);
+	if (rc)
+		return rc;
 
 	write_lock_irqsave(&devtree_lock, flags);
 	np->sibling = np->parent->child;
@@ -1134,6 +1191,7 @@
 	write_unlock_irqrestore(&devtree_lock, flags);
 
 	of_add_proc_dt_entry(np);
+	return 0;
 }
 
 #ifdef CONFIG_PROC_DEVICETREE
@@ -1163,23 +1221,28 @@
  * The caller must hold a reference to the node.  The memory associated with
  * the node is not freed until its refcount goes to zero.
  */
-void of_detach_node(struct device_node *np)
+int of_detach_node(struct device_node *np)
 {
 	struct device_node *parent;
 	unsigned long flags;
+	int rc = 0;
+
+	rc = of_reconfig_notify(OF_RECONFIG_DETACH_NODE, np);
+	if (rc)
+		return rc;
 
 	write_lock_irqsave(&devtree_lock, flags);
 
 	if (of_node_check_flag(np, OF_DETACHED)) {
 		/* someone already detached it */
 		write_unlock_irqrestore(&devtree_lock, flags);
-		return;
+		return rc;
 	}
 
 	parent = np->parent;
 	if (!parent) {
 		write_unlock_irqrestore(&devtree_lock, flags);
-		return;
+		return rc;
 	}
 
 	if (allnodes == np)
@@ -1208,6 +1271,7 @@
 	write_unlock_irqrestore(&devtree_lock, flags);
 
 	of_remove_proc_dt_entry(np);
+	return rc;
 }
 #endif /* defined(CONFIG_OF_DYNAMIC) */
 
Index: dt-next/arch/powerpc/include/asm/pSeries_reconfig.h
===================================================================
--- dt-next.orig/arch/powerpc/include/asm/pSeries_reconfig.h	2012-10-02 08:30:21.000000000 -0500
+++ dt-next/arch/powerpc/include/asm/pSeries_reconfig.h	2012-10-02 08:43:40.000000000 -0500
@@ -2,43 +2,11 @@
 #define _PPC64_PSERIES_RECONFIG_H
 #ifdef __KERNEL__
 
-#include <linux/notifier.h>
-
-/*
- * Use this API if your code needs to know about OF device nodes being
- * added or removed on pSeries systems.
- */
-
-#define PSERIES_RECONFIG_ADD		0x0001
-#define PSERIES_RECONFIG_REMOVE		0x0002
-#define PSERIES_DRCONF_MEM_ADD		0x0003
-#define PSERIES_DRCONF_MEM_REMOVE	0x0004
-#define PSERIES_UPDATE_PROPERTY		0x0005
-
-/**
- * pSeries_reconfig_notify - Notifier value structure for OFDT property updates
- *
- * @node: Device tree node which owns the property being updated
- * @property: Updated property
- */
-struct pSeries_reconfig_prop_update {
-	struct device_node *node;
-	struct property *property;
-};
-
 #ifdef CONFIG_PPC_PSERIES
-extern int pSeries_reconfig_notifier_register(struct notifier_block *);
-extern void pSeries_reconfig_notifier_unregister(struct notifier_block *);
-extern int pSeries_reconfig_notify(unsigned long action, void *p);
 /* Not the best place to put this, will be fixed when we move some
  * of the rtas suspend-me stuff to pseries */
 extern void pSeries_coalesce_init(void);
 #else /* !CONFIG_PPC_PSERIES */
-static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
-{
-	return 0;
-}
-static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { }
 static inline void pSeries_coalesce_init(void) { }
 #endif /* CONFIG_PPC_PSERIES */
 
Index: dt-next/arch/powerpc/platforms/pseries/hotplug-cpu.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/hotplug-cpu.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/hotplug-cpu.c	2012-10-02 08:43:40.000000000 -0500
@@ -23,12 +23,12 @@
 #include <linux/delay.h>
 #include <linux/sched.h>	/* for idle_task_exit */
 #include <linux/cpu.h>
+#include <linux/of.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/firmware.h>
 #include <asm/machdep.h>
 #include <asm/vdso_datapage.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/xics.h>
 #include "plpar_wrappers.h"
 #include "offline_states.h"
@@ -333,10 +333,10 @@
 	int err = 0;
 
 	switch (action) {
-	case PSERIES_RECONFIG_ADD:
+	case OF_RECONFIG_ATTACH_NODE:
 		err = pseries_add_processor(node);
 		break;
-	case PSERIES_RECONFIG_REMOVE:
+	case OF_RECONFIG_DETACH_NODE:
 		pseries_remove_processor(node);
 		break;
 	}
@@ -399,7 +399,7 @@
 
 	/* Processors can be added/removed only on LPAR */
 	if (firmware_has_feature(FW_FEATURE_LPAR)) {
-		pSeries_reconfig_notifier_register(&pseries_smp_nb);
+		of_reconfig_notifier_register(&pseries_smp_nb);
 		cpu_maps_update_begin();
 		if (cede_offline_enabled && parse_cede_parameters() == 0) {
 			default_offline_state = CPU_STATE_INACTIVE;
Index: dt-next/arch/powerpc/platforms/pseries/hotplug-memory.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/hotplug-memory.c	2012-10-02 08:30:04.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/hotplug-memory.c	2012-10-02 08:43:40.000000000 -0500
@@ -16,7 +16,6 @@
 
 #include <asm/firmware.h>
 #include <asm/machdep.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/sparsemem.h>
 
 static unsigned long get_memblock_size(void)
@@ -181,42 +180,69 @@
 	return (ret < 0) ? -EINVAL : 0;
 }
 
-static int pseries_drconf_memory(unsigned long *base, unsigned int action)
+static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
 {
+	struct of_drconf_cell *new_drmem, *old_drmem;
 	unsigned long memblock_size;
-	int rc;
+	u32 entries;
+	u32 *p;
+	int i, rc = -EINVAL;
 
 	memblock_size = get_memblock_size();
 	if (!memblock_size)
 		return -EINVAL;
 
-	if (action == PSERIES_DRCONF_MEM_ADD) {
-		rc = memblock_add(*base, memblock_size);
-		rc = (rc < 0) ? -EINVAL : 0;
-	} else if (action == PSERIES_DRCONF_MEM_REMOVE) {
-		rc = pseries_remove_memblock(*base, memblock_size);
-	} else {
-		rc = -EINVAL;
+	p = (u32 *)of_get_property(pr->dn, "ibm,dynamic-memory", NULL);
+	if (!p)
+		return -EINVAL;
+
+	/* The first int of the property is the number of lmb's described
+	 * by the property. This is followed by an array of of_drconf_cell
+	 * entries. Get the niumber of entries and skip to the array of
+	 * of_drconf_cell's.
+	 */
+	entries = *p++;
+	old_drmem = (struct of_drconf_cell *)p;
+
+	p = (u32 *)pr->prop->value;
+	p++;
+	new_drmem = (struct of_drconf_cell *)p;
+
+	for (i = 0; i < entries; i++) {
+		if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) &&
+		    (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) {
+			rc = pseries_remove_memblock(old_drmem[i].base_addr,
+						     memblock_size);
+			break;
+		} else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) &&
+			   (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) {
+			rc = memblock_add(old_drmem[i].base_addr,
+					  memblock_size);
+			rc = (rc < 0) ? -EINVAL : 0;
+			break;
+		}
 	}
 
 	return rc;
 }
 
 static int pseries_memory_notifier(struct notifier_block *nb,
-				unsigned long action, void *node)
+				   unsigned long action, void *node)
 {
+	struct of_prop_reconfig *pr;
 	int err = 0;
 
 	switch (action) {
-	case PSERIES_RECONFIG_ADD:
+	case OF_RECONFIG_ATTACH_NODE:
 		err = pseries_add_memory(node);
 		break;
-	case PSERIES_RECONFIG_REMOVE:
+	case OF_RECONFIG_DETACH_NODE:
 		err = pseries_remove_memory(node);
 		break;
-	case PSERIES_DRCONF_MEM_ADD:
-	case PSERIES_DRCONF_MEM_REMOVE:
-		err = pseries_drconf_memory(node, action);
+	case OF_RECONFIG_UPDATE_PROPERTY:
+		pr = (struct of_prop_reconfig *)node;
+		if (!strcmp(pr->prop->name, "ibm,dynamic-memory"))
+			err = pseries_update_drconf_memory(pr);
 		break;
 	}
 	return notifier_from_errno(err);
@@ -229,7 +255,7 @@
 static int __init pseries_memory_hotplug_init(void)
 {
 	if (firmware_has_feature(FW_FEATURE_LPAR))
-		pSeries_reconfig_notifier_register(&pseries_mem_nb);
+		of_reconfig_notifier_register(&pseries_mem_nb);
 
 	return 0;
 }
Index: dt-next/include/linux/of.h
===================================================================
--- dt-next.orig/include/linux/of.h	2012-10-02 08:31:08.000000000 -0500
+++ dt-next/include/linux/of.h	2012-10-02 08:50:22.000000000 -0500
@@ -21,6 +21,7 @@
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
 #include <linux/spinlock.h>
+#include <linux/notifier.h>
 
 #include <asm/byteorder.h>
 #include <asm/errno.h>
@@ -270,8 +271,23 @@
 
 #if defined(CONFIG_OF_DYNAMIC)
 /* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
+#define OF_RECONFIG_ATTACH_NODE		0x0001
+#define OF_RECONFIG_DETACH_NODE		0x0002
+#define OF_RECONFIG_ADD_PROPERTY	0x0003
+#define OF_RECONFIG_REMOVE_PROPERTY	0x0004
+#define OF_RECONFIG_UPDATE_PROPERTY	0x0005
+
+struct of_prop_reconfig {
+	struct device_node	*dn;
+	struct property		*prop;
+};
+
+extern int of_reconfig_notifier_register(struct notifier_block *);
+extern int of_reconfig_notifier_unregister(struct notifier_block *);
+extern int of_reconfig_notify(unsigned long, void *);
+
+extern int of_attach_node(struct device_node *);
+extern int of_detach_node(struct device_node *);
 #endif
 
 #define of_match_ptr(_ptr)	(_ptr)
Index: dt-next/arch/powerpc/kernel/prom.c
===================================================================
--- dt-next.orig/arch/powerpc/kernel/prom.c	2012-10-02 08:30:22.000000000 -0500
+++ dt-next/arch/powerpc/kernel/prom.c	2012-10-02 08:43:40.000000000 -0500
@@ -32,6 +32,7 @@
 #include <linux/debugfs.h>
 #include <linux/irq.h>
 #include <linux/memblock.h>
+#include <linux/of.h>
 
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -49,7 +50,6 @@
 #include <asm/btext.h>
 #include <asm/sections.h>
 #include <asm/machdep.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/pci-bridge.h>
 #include <asm/kexec.h>
 #include <asm/opal.h>
@@ -802,7 +802,7 @@
 	int err;
 
 	switch (action) {
-	case PSERIES_RECONFIG_ADD:
+	case OF_RECONFIG_ATTACH_NODE:
 		err = of_finish_dynamic_node(node);
 		if (err < 0)
 			printk(KERN_ERR "finish_node returned %d\n", err);
@@ -821,7 +821,7 @@
 
 static int __init prom_reconfig_setup(void)
 {
-	return pSeries_reconfig_notifier_register(&prom_reconfig_nb);
+	return of_reconfig_notifier_register(&prom_reconfig_nb);
 }
 __initcall(prom_reconfig_setup);
 #endif
Index: dt-next/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/iommu.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/iommu.c	2012-10-02 08:43:40.000000000 -0500
@@ -35,6 +35,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/crash_dump.h>
 #include <linux/memory.h>
+#include <linux/of.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -42,7 +43,6 @@
 #include <asm/pci-bridge.h>
 #include <asm/machdep.h>
 #include <asm/abs_addr.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/firmware.h>
 #include <asm/tce.h>
 #include <asm/ppc-pci.h>
@@ -1211,7 +1211,7 @@
 	struct direct_window *window;
 
 	switch (action) {
-	case PSERIES_RECONFIG_REMOVE:
+	case OF_RECONFIG_DETACH_NODE:
 		if (pci && pci->iommu_table)
 			iommu_free_table(pci->iommu_table, np->full_name);
 
@@ -1274,7 +1274,7 @@
 	}
 
 
-	pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
+	of_reconfig_notifier_register(&iommu_reconfig_nb);
 	register_memory_notifier(&iommu_mem_nb);
 
 	set_pci_dma_ops(&dma_iommu_ops);
Index: dt-next/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/setup.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/setup.c	2012-10-02 08:43:40.000000000 -0500
@@ -40,6 +40,7 @@
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/cpuidle.h>
+#include <linux/of.h>
 
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -63,7 +64,6 @@
 #include <asm/smp.h>
 #include <asm/firmware.h>
 #include <asm/eeh.h>
-#include <asm/pSeries_reconfig.h>
 
 #include "plpar_wrappers.h"
 #include "pseries.h"
@@ -258,7 +258,7 @@
 	int err = NOTIFY_OK;
 
 	switch (action) {
-	case PSERIES_RECONFIG_ADD:
+	case OF_RECONFIG_ATTACH_NODE:
 		pci = np->parent->data;
 		if (pci) {
 			update_dn_pci_info(np, pci->phb);
@@ -390,7 +390,7 @@
 	init_pci_config_tokens();
 	eeh_pseries_init();
 	find_and_init_phbs();
-	pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
+	of_reconfig_notifier_register(&pci_dn_reconfig_nb);
 	eeh_init();
 
 	pSeries_nvram_init();
Index: dt-next/arch/powerpc/platforms/pseries/dlpar.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/dlpar.c	2012-10-02 08:40:51.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/dlpar.c	2012-10-02 08:43:40.000000000 -0500
@@ -16,13 +16,13 @@
 #include <linux/spinlock.h>
 #include <linux/cpu.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 #include "offline_states.h"
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/uaccess.h>
 #include <asm/rtas.h>
-#include <asm/pSeries_reconfig.h>
 
 struct cc_workarea {
 	u32	drc_index;
@@ -262,24 +262,26 @@
 	if (!dn->parent)
 		return -ENOMEM;
 
-	rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn);
+	rc = of_attach_node(dn);
 	if (rc) {
 		printk(KERN_ERR "Failed to add device node %s\n",
 		       dn->full_name);
 		return rc;
 	}
 
-	of_attach_node(dn);
 	of_node_put(dn->parent);
 	return 0;
 }
 
 int dlpar_detach_node(struct device_node *dn)
 {
-	pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
-	of_detach_node(dn);
-	of_node_put(dn); /* Must decrement the refcount */
+	int rc;
 
+	rc = of_detach_node(dn);
+	if (rc)
+		return rc;
+
+	of_node_put(dn); /* Must decrement the refcount */
 	return 0;
 }
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/5] Rename the drivers/of prom_* functions to of_*
  2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
                   ` (2 preceding siblings ...)
  2012-10-03  2:57 ` [PATCH 3/5] Add of node/property notification chain for adds and removes Nathan Fontenot
@ 2012-10-03  2:58 ` Nathan Fontenot
  2012-10-05 16:22   ` [Cbe-oss-dev] " Geoff Levand
  2012-10-03  2:59 ` [PATCH 5/5] Remove the pSeries_reconfig.h file Nathan Fontenot
  2012-10-08 23:54 ` [PATCH 0/5] Move some OF functionality from pseries to generic OF code Michael Ellerman
  5 siblings, 1 reply; 9+ messages in thread
From: Nathan Fontenot @ 2012-10-03  2:58 UTC (permalink / raw)
  To: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

Rename the prom_*_property routines of the generic OF code to of_*_property.
This brings them in line with the naming used by the rest of the OF code.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/machine_kexec.c       |   12 ++++++------
 arch/powerpc/kernel/machine_kexec_64.c    |    8 ++++----
 arch/powerpc/kernel/pci_32.c              |    2 +-
 arch/powerpc/platforms/ps3/os-area.c      |    6 +++---
 arch/powerpc/platforms/pseries/iommu.c    |    4 ++--
 arch/powerpc/platforms/pseries/mobility.c |    6 +++---
 arch/powerpc/platforms/pseries/reconfig.c |    8 ++++----
 drivers/macintosh/smu.c                   |    2 +-
 drivers/of/base.c                         |   15 +++++++--------
 include/linux/of.h                        |    9 ++++-----
 10 files changed, 35 insertions(+), 37 deletions(-)

Index: dt-next/include/linux/of.h
===================================================================
--- dt-next.orig/include/linux/of.h	2012-10-02 08:50:22.000000000 -0500
+++ dt-next/include/linux/of.h	2012-10-02 09:07:23.000000000 -0500
@@ -263,11 +263,10 @@
 
 extern int of_machine_is_compatible(const char *compat);
 
-extern int prom_add_property(struct device_node* np, struct property* prop);
-extern int prom_remove_property(struct device_node *np, struct property *prop);
-extern int prom_update_property(struct device_node *np,
-				struct property *newprop,
-				struct property *oldprop);
+extern int of_add_property(struct device_node *np, struct property *prop);
+extern int of_remove_property(struct device_node *np, struct property *prop);
+extern int of_update_property(struct device_node *np, struct property *newprop,
+			      struct property *oldprop);
 
 #if defined(CONFIG_OF_DYNAMIC)
 /* For updating the device tree at runtime */
Index: dt-next/arch/powerpc/kernel/pci_32.c
===================================================================
--- dt-next.orig/arch/powerpc/kernel/pci_32.c	2012-10-02 08:30:22.000000000 -0500
+++ dt-next/arch/powerpc/kernel/pci_32.c	2012-10-02 09:01:10.000000000 -0500
@@ -208,7 +208,7 @@
 		of_prop->name = "pci-OF-bus-map";
 		of_prop->length = 256;
 		of_prop->value = &of_prop[1];
-		prom_add_property(dn, of_prop);
+		of_add_property(dn, of_prop);
 		of_node_put(dn);
 	}
 }
Index: dt-next/arch/powerpc/kernel/machine_kexec.c
===================================================================
--- dt-next.orig/arch/powerpc/kernel/machine_kexec.c	2012-10-02 08:30:22.000000000 -0500
+++ dt-next/arch/powerpc/kernel/machine_kexec.c	2012-10-02 09:01:10.000000000 -0500
@@ -212,16 +212,16 @@
 	 * be sure what's in them, so remove them. */
 	prop = of_find_property(node, "linux,crashkernel-base", NULL);
 	if (prop)
-		prom_remove_property(node, prop);
+		of_remove_property(node, prop);
 
 	prop = of_find_property(node, "linux,crashkernel-size", NULL);
 	if (prop)
-		prom_remove_property(node, prop);
+		of_remove_property(node, prop);
 
 	if (crashk_res.start != 0) {
-		prom_add_property(node, &crashk_base_prop);
+		of_add_property(node, &crashk_base_prop);
 		crashk_size = resource_size(&crashk_res);
-		prom_add_property(node, &crashk_size_prop);
+		of_add_property(node, &crashk_size_prop);
 	}
 }
 
@@ -237,11 +237,11 @@
 	/* remove any stale properties so ours can be found */
 	prop = of_find_property(node, kernel_end_prop.name, NULL);
 	if (prop)
-		prom_remove_property(node, prop);
+		of_remove_property(node, prop);
 
 	/* information needed by userspace when using default_machine_kexec */
 	kernel_end = __pa(_end);
-	prom_add_property(node, &kernel_end_prop);
+	of_add_property(node, &kernel_end_prop);
 
 	export_crashk_values(node);
 
Index: dt-next/arch/powerpc/kernel/machine_kexec_64.c
===================================================================
--- dt-next.orig/arch/powerpc/kernel/machine_kexec_64.c	2012-10-02 08:30:22.000000000 -0500
+++ dt-next/arch/powerpc/kernel/machine_kexec_64.c	2012-10-02 09:01:10.000000000 -0500
@@ -389,14 +389,14 @@
 	/* remove any stale propertys so ours can be found */
 	prop = of_find_property(node, htab_base_prop.name, NULL);
 	if (prop)
-		prom_remove_property(node, prop);
+		of_remove_property(node, prop);
 	prop = of_find_property(node, htab_size_prop.name, NULL);
 	if (prop)
-		prom_remove_property(node, prop);
+		of_remove_property(node, prop);
 
 	htab_base = __pa(htab_address);
-	prom_add_property(node, &htab_base_prop);
-	prom_add_property(node, &htab_size_prop);
+	of_add_property(node, &htab_base_prop);
+	of_add_property(node, &htab_size_prop);
 
 	of_node_put(node);
 	return 0;
Index: dt-next/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/reconfig.c	2012-10-02 08:45:12.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/reconfig.c	2012-10-02 09:14:31.000000000 -0500
@@ -326,7 +326,7 @@
 	if (!prop)
 		return -ENOMEM;
 
-	prom_add_property(np, prop);
+	of_add_property(np, prop);
 
 	return 0;
 }
@@ -350,7 +350,7 @@
 
 	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)
@@ -380,11 +380,11 @@
 	oldprop = of_find_property(np, name,NULL);
 	if (!oldprop) {
 		if (strlen(name))
-			return prom_add_property(np, newprop);
+			return of_add_property(np, newprop);
 		return -ENODEV;
 	}
 
-	rc = prom_update_property(np, newprop, oldprop);
+	rc = of_update_property(np, newprop, oldprop);
 	return rc;
 }
 
Index: dt-next/arch/powerpc/platforms/pseries/mobility.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/mobility.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/mobility.c	2012-10-02 09:03:54.000000000 -0500
@@ -119,9 +119,9 @@
 	if (!more) {
 		old_prop = of_find_property(dn, new_prop->name, NULL);
 		if (old_prop)
-			prom_update_property(dn, new_prop, old_prop);
+			of_update_property(dn, new_prop, old_prop);
 		else
-			prom_add_property(dn, new_prop);
+			of_add_property(dn, new_prop);
 
 		new_prop = NULL;
 	}
@@ -178,7 +178,7 @@
 
 			case 0x80000000:
 				prop = of_find_property(dn, prop_name, NULL);
-				prom_remove_property(dn, prop);
+				of_remove_property(dn, prop);
 				prop = NULL;
 				break;
 
Index: dt-next/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/iommu.c	2012-10-02 08:43:40.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/iommu.c	2012-10-02 09:01:10.000000000 -0500
@@ -747,7 +747,7 @@
 			np->full_name, ret, ddw_avail[2], liobn);
 
 delprop:
-	ret = prom_remove_property(np, win64);
+	ret = of_remove_property(np, win64);
 	if (ret)
 		pr_warning("%s: failed to remove direct window property: %d\n",
 			np->full_name, ret);
@@ -991,7 +991,7 @@
 		goto out_free_window;
 	}
 
-	ret = prom_add_property(pdn, win64);
+	ret = of_add_property(pdn, win64);
 	if (ret) {
 		dev_err(&dev->dev, "unable to add dma window property for %s: %d",
 			 pdn->full_name, ret);
Index: dt-next/arch/powerpc/platforms/ps3/os-area.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/ps3/os-area.c	2012-10-02 08:30:23.000000000 -0500
+++ dt-next/arch/powerpc/platforms/ps3/os-area.c	2012-10-02 09:01:10.000000000 -0500
@@ -280,13 +280,13 @@
 
 	if (tmp) {
 		pr_debug("%s:%d found %s\n", __func__, __LINE__, prop->name);
-		prom_remove_property(node, tmp);
+		of_remove_property(node, tmp);
 	}
 
-	result = prom_add_property(node, prop);
+	result = of_add_property(node, prop);
 
 	if (result)
-		pr_debug("%s:%d prom_set_property failed\n", __func__,
+		pr_debug("%s:%d of_set_property failed\n", __func__,
 			__LINE__);
 }
 
Index: dt-next/drivers/macintosh/smu.c
===================================================================
--- dt-next.orig/drivers/macintosh/smu.c	2012-10-02 08:30:35.000000000 -0500
+++ dt-next/drivers/macintosh/smu.c	2012-10-02 09:01:10.000000000 -0500
@@ -998,7 +998,7 @@
 		       "%02x !\n", id, hdr->id);
 		goto failure;
 	}
-	if (prom_add_property(smu->of_node, prop)) {
+	if (of_add_property(smu->of_node, prop)) {
 		printk(KERN_DEBUG "SMU: Failed creating sdb-partition-%02x "
 		       "property !\n", id);
 		goto failure;
Index: dt-next/drivers/of/base.c
===================================================================
--- dt-next.orig/drivers/of/base.c	2012-10-02 08:58:55.000000000 -0500
+++ dt-next/drivers/of/base.c	2012-10-02 09:05:37.000000000 -0500
@@ -997,9 +997,9 @@
 #endif
 
 /**
- * prom_add_property - Add a property to a node
+ * of_add_property - Add a property to a node
  */
-int prom_add_property(struct device_node *np, struct property *prop)
+int of_add_property(struct device_node *np, struct property *prop)
 {
 	struct property **next;
 	unsigned long flags;
@@ -1033,14 +1033,14 @@
 }
 
 /**
- * prom_remove_property - Remove a property from a node.
+ * of_remove_property - Remove a property from a node.
  *
  * Note that we don't actually remove it, since we have given out
  * who-knows-how-many pointers to the data using get-property.
  * Instead we just move the property to the "dead properties"
  * list, so it won't be found any more.
  */
-int prom_remove_property(struct device_node *np, struct property *prop)
+int of_remove_property(struct device_node *np, struct property *prop)
 {
 	struct property **next;
 	unsigned long flags;
@@ -1079,16 +1079,15 @@
 }
 
 /*
- * prom_update_property - Update a property in a node.
+ * of_update_property - Update a property in a node.
  *
  * Note that we don't actually remove it, since we have given out
  * who-knows-how-many pointers to the data using get-property.
  * Instead we just move the property to the "dead properties" list,
  * and add the new property to the property list
  */
-int prom_update_property(struct device_node *np,
-			 struct property *newprop,
-			 struct property *oldprop)
+int of_update_property(struct device_node *np, struct property *newprop,
+		       struct property *oldprop)
 {
 	struct property **next;
 	unsigned long flags;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/5] Remove the pSeries_reconfig.h file
  2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
                   ` (3 preceding siblings ...)
  2012-10-03  2:58 ` [PATCH 4/5] Rename the drivers/of prom_* functions to of_* Nathan Fontenot
@ 2012-10-03  2:59 ` Nathan Fontenot
  2012-10-08 23:54 ` [PATCH 0/5] Move some OF functionality from pseries to generic OF code Michael Ellerman
  5 siblings, 0 replies; 9+ messages in thread
From: Nathan Fontenot @ 2012-10-03  2:59 UTC (permalink / raw)
  To: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

Remove the pSeries_reconfig.h header file. At this point there is only one
definition in the file, pSeries_coalesce_init(), which can be
moved to rtas.h.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pSeries_reconfig.h |   15 ---------------
 arch/powerpc/include/asm/rtas.h             |    5 +++++
 arch/powerpc/kernel/rtas.c                  |    1 -
 arch/powerpc/platforms/pseries/smp.c        |    1 -
 4 files changed, 5 insertions(+), 17 deletions(-)

Index: dt-next/arch/powerpc/include/asm/pSeries_reconfig.h
===================================================================
--- dt-next.orig/arch/powerpc/include/asm/pSeries_reconfig.h	2012-10-02 09:14:01.000000000 -0500
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-#ifndef _PPC64_PSERIES_RECONFIG_H
-#define _PPC64_PSERIES_RECONFIG_H
-#ifdef __KERNEL__
-
-#ifdef CONFIG_PPC_PSERIES
-/* Not the best place to put this, will be fixed when we move some
- * of the rtas suspend-me stuff to pseries */
-extern void pSeries_coalesce_init(void);
-#else /* !CONFIG_PPC_PSERIES */
-static inline void pSeries_coalesce_init(void) { }
-#endif /* CONFIG_PPC_PSERIES */
-
-
-#endif /* __KERNEL__ */
-#endif /* _PPC64_PSERIES_RECONFIG_H */
Index: dt-next/arch/powerpc/include/asm/rtas.h
===================================================================
--- dt-next.orig/arch/powerpc/include/asm/rtas.h	2012-10-02 09:14:01.000000000 -0500
+++ dt-next/arch/powerpc/include/asm/rtas.h	2012-10-02 09:14:40.000000000 -0500
@@ -353,8 +353,13 @@
 		return 1;
 	return 0;
 }
+
+/* Not the best place to put pSeries_coalesce_init, will be fixed when we
+ * move some of the rtas suspend-me stuff to pseries */
+extern void pSeries_coalesce_init(void);
 #else
 static inline int page_is_rtas_user_buf(unsigned long pfn) { return 0;}
+static inline void pSeries_coalesce_init(void) { }
 #endif
 
 extern int call_rtas(const char *, int, int, unsigned long *, ...);
Index: dt-next/arch/powerpc/kernel/rtas.c
===================================================================
--- dt-next.orig/arch/powerpc/kernel/rtas.c	2012-10-02 09:14:01.000000000 -0500
+++ dt-next/arch/powerpc/kernel/rtas.c	2012-10-02 09:14:40.000000000 -0500
@@ -42,7 +42,6 @@
 #include <asm/time.h>
 #include <asm/mmu.h>
 #include <asm/topology.h>
-#include <asm/pSeries_reconfig.h>
 
 struct rtas_t rtas = {
 	.lock = __ARCH_SPIN_LOCK_UNLOCKED
Index: dt-next/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- dt-next.orig/arch/powerpc/platforms/pseries/smp.c	2012-10-02 09:14:01.000000000 -0500
+++ dt-next/arch/powerpc/platforms/pseries/smp.c	2012-10-02 09:14:40.000000000 -0500
@@ -38,7 +38,6 @@
 #include <asm/cputable.h>
 #include <asm/firmware.h>
 #include <asm/rtas.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/mpic.h>
 #include <asm/vdso_datapage.h>
 #include <asm/cputhreads.h>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cbe-oss-dev] [PATCH 4/5] Rename the drivers/of prom_* functions to of_*
  2012-10-03  2:58 ` [PATCH 4/5] Rename the drivers/of prom_* functions to of_* Nathan Fontenot
@ 2012-10-05 16:22   ` Geoff Levand
  0 siblings, 0 replies; 9+ messages in thread
From: Geoff Levand @ 2012-10-05 16:22 UTC (permalink / raw)
  To: Nathan Fontenot; +Cc: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

On Tue, 2012-10-02 at 21:58 -0500, Nathan Fontenot wrote:
> Rename the prom_*_property routines of the generic OF code to of_*_property.
> This brings them in line with the naming used by the rest of the OF code.
> 
> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/ps3/os-area.c      |    6 +++---
>  10 files changed, 35 insertions(+), 37 deletions(-)

The ps3 part looks OK.  Please do build test with ps3_defconfig.

Acked-by: Geoff Levand <geoff@infradead.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] Move some OF functionality from pseries to generic OF code
  2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
                   ` (4 preceding siblings ...)
  2012-10-03  2:59 ` [PATCH 5/5] Remove the pSeries_reconfig.h file Nathan Fontenot
@ 2012-10-08 23:54 ` Michael Ellerman
  5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2012-10-08 23:54 UTC (permalink / raw)
  To: Nathan Fontenot; +Cc: devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

On Tue, 2012-10-02 at 13:11 -0500, Nathan Fontenot wrote:
> This set of patches moves some OF code that has been living
> in the pseries tree over to the generic OF code base. The
> functionality being migrated over is something that, I believe,
> should live in the generic code base. The specific functionality
> being migrated to generic OF code is;

Your changes collide with commit 475d0094293:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=475d0094293b51353e342d1198377967dbc48169


At a quick glance they don't look like they conflict in concept, just
textually.

cheers



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] Add /proc device tree updating to of node add/remove
  2012-10-03  2:55 ` [PATCH 1/5] Add /proc device tree updating to of node add/remove Nathan Fontenot
@ 2012-11-14 14:38   ` Grant Likely
  0 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2012-11-14 14:38 UTC (permalink / raw)
  To: Nathan Fontenot, devicetree-discuss, cbe-oss-dev, LKML, linuxppc-dev

On Tue, 02 Oct 2012 21:55:01 -0500, Nathan Fontenot <nfont@linux.vnet.ibm.com> wrote:
> When adding or removing a device tree node we should also update
> the device tree in /proc/device-tree. This action is already done in the
> generic OF code for adding/removing properties of a node. This patch adds
> this functionality for nodes.
> 
> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> 

For the whole series:

Acked-by: Grant Likely <grant.likely@secretlab.ca>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-14 14:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02 18:11 [PATCH 0/5] Move some OF functionality from pseries to generic OF code Nathan Fontenot
2012-10-03  2:55 ` [PATCH 1/5] Add /proc device tree updating to of node add/remove Nathan Fontenot
2012-11-14 14:38   ` Grant Likely
2012-10-03  2:56 ` [PATCH 2/5] Move of_drconf_cell struct definition to asm/prom.h Nathan Fontenot
2012-10-03  2:57 ` [PATCH 3/5] Add of node/property notification chain for adds and removes Nathan Fontenot
2012-10-03  2:58 ` [PATCH 4/5] Rename the drivers/of prom_* functions to of_* Nathan Fontenot
2012-10-05 16:22   ` [Cbe-oss-dev] " Geoff Levand
2012-10-03  2:59 ` [PATCH 5/5] Remove the pSeries_reconfig.h file Nathan Fontenot
2012-10-08 23:54 ` [PATCH 0/5] Move some OF functionality from pseries to generic OF code Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).