Skip to contentSkip to conversation

Move some OF functionality from pseries to generic OF code

PATCH In review Nathan Fontenot 4 participants 9 messages Oct 2, 2012 – Nov 14, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Move some OF functionality from pseries to generic OF code

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

#1 lore raw

PATCH 1/5 Add /proc device tree updating to of node add/remove

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.

---
 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(-)
arch/powerpc/platforms/pseries/dlpar.c +0 -24
Index: dt-next/arch/powerpc/platforms/pseries/dlpar.c
===================================================================
@@ -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 */
arch/powerpc/platforms/pseries/reconfig.c +0 -47

65 lines not on this page · raw message

drivers/of/base.c +51 -4

81 lines not on this page · raw message

Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] Add /proc device tree updating to of node add/remove

Quoted 6 lines · Nathan Fontenot

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.

For the whole series:

#3 lore raw

PATCH 2/5 Move of_drconf_cell struct definition to asm/prom.h

In reply to Nathan Fontenot

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

---
 arch/powerpc/include/asm/prom.h |   16 ++++++++++++++++
 arch/powerpc/mm/numa.c          |   12 ------------
 2 files changed, 16 insertions(+), 12 deletions(-)
arch/powerpc/mm/numa.c +0 -12
Index: dt-next/arch/powerpc/mm/numa.c
===================================================================
@@ -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.
arch/powerpc/include/asm/prom.h +16 -0
Index: dt-next/arch/powerpc/include/asm/prom.h
===================================================================
@@ -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
#4 lore raw

PATCH 3/5 Add of node/property notification chain for adds and removes

In reply to Nathan Fontenot

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.

---
 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(-)
arch/powerpc/platforms/pseries/reconfig.c +3 -62
Index: dt-next/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
@@ -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;
 }
 
 /**
drivers/of/base.c +69 -5

144 lines not on this page · raw message

arch/powerpc/include/asm/pSeries_reconfig.h +0 -32
Index: dt-next/arch/powerpc/include/asm/pSeries_reconfig.h
===================================================================
@@ -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 */
 
arch/powerpc/platforms/pseries/hotplug-cpu.c +4 -4
Index: dt-next/arch/powerpc/platforms/pseries/hotplug-cpu.c
===================================================================
@@ -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;
arch/powerpc/platforms/pseries/hotplug-memory.c +43 -17

99 lines not on this page · raw message

include/linux/of.h +18 -2
Index: dt-next/include/linux/of.h
===================================================================
@@ -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)
arch/powerpc/kernel/prom.c +3 -3
Index: dt-next/arch/powerpc/kernel/prom.c
===================================================================
@@ -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
arch/powerpc/platforms/pseries/iommu.c +3 -3
Index: dt-next/arch/powerpc/platforms/pseries/iommu.c
===================================================================
@@ -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);
arch/powerpc/platforms/pseries/setup.c +3 -3
Index: dt-next/arch/powerpc/platforms/pseries/setup.c
===================================================================
@@ -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();
arch/powerpc/platforms/pseries/dlpar.c +8 -6
Index: dt-next/arch/powerpc/platforms/pseries/dlpar.c
===================================================================
@@ -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;
 }
#5 lore raw

PATCH 4/5 Rename the drivers/of prom_* functions to of_*

In reply to Nathan Fontenot

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.

---
 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(-)
include/linux/of.h +4 -5
Index: dt-next/include/linux/of.h
===================================================================
@@ -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 */
arch/powerpc/kernel/pci_32.c +1 -1
Index: dt-next/arch/powerpc/kernel/pci_32.c
===================================================================
@@ -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);
 	}
 }
arch/powerpc/kernel/machine_kexec.c +6 -6
Index: dt-next/arch/powerpc/kernel/machine_kexec.c
===================================================================
@@ -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);
 
arch/powerpc/kernel/machine_kexec_64.c +4 -4
Index: dt-next/arch/powerpc/kernel/machine_kexec_64.c
===================================================================
@@ -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;
arch/powerpc/platforms/pseries/reconfig.c +4 -4
Index: dt-next/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
@@ -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;
 }
 
arch/powerpc/platforms/pseries/mobility.c +3 -3
Index: dt-next/arch/powerpc/platforms/pseries/mobility.c
===================================================================
@@ -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;
 
arch/powerpc/platforms/pseries/iommu.c +2 -2
Index: dt-next/arch/powerpc/platforms/pseries/iommu.c
===================================================================
@@ -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);
arch/powerpc/platforms/ps3/os-area.c +3 -3
Index: dt-next/arch/powerpc/platforms/ps3/os-area.c
===================================================================
@@ -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__);
 }
 
drivers/macintosh/smu.c +1 -1
Index: dt-next/drivers/macintosh/smu.c
===================================================================
@@ -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;
drivers/of/base.c +7 -8
Index: dt-next/drivers/of/base.c
===================================================================
@@ -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;
maintainer Acked-by on v1 4/5
#6 lore raw

Re: [Cbe-oss-dev] [PATCH 4/5] Rename the drivers/of prom_* functions to of_*

Quoted 7 lines · Nathan Fontenot

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.

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

#7 lore raw

PATCH 5/5 Remove the pSeries_reconfig.h file

In reply to Nathan Fontenot

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.

---
 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(-)
arch/powerpc/include/asm/pSeries_reconfig.h deleted +0 -15
Index: dt-next/arch/powerpc/include/asm/pSeries_reconfig.h
===================================================================
@@ -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 */
arch/powerpc/include/asm/rtas.h +5 -0
Index: dt-next/arch/powerpc/include/asm/rtas.h
===================================================================
@@ -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 *, ...);
arch/powerpc/kernel/rtas.c +0 -1
Index: dt-next/arch/powerpc/kernel/rtas.c
===================================================================
@@ -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
arch/powerpc/platforms/pseries/smp.c +0 -1
Index: dt-next/arch/powerpc/platforms/pseries/smp.c
===================================================================
@@ -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>
#8 lore raw
In reply to Nathan Fontenot
Quoted 5 lines · Nathan Fontenot

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