powerpc+of: Add of node/property notification chain for adds and removes
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> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:

committed by
Benjamin Herrenschmidt

parent
f594972083
commit
1cf3d8b3d2
@@ -22,6 +22,7 @@
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/errno.h>
|
||||
@@ -272,11 +273,24 @@ extern int prom_remove_property(struct device_node *np, struct property *prop);
|
||||
extern int prom_update_property(struct device_node *np,
|
||||
struct property *newprop);
|
||||
|
||||
#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 *);
|
||||
#endif
|
||||
#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 *);
|
||||
|
||||
#define of_match_ptr(_ptr) (_ptr)
|
||||
|
||||
|
Reference in New Issue
Block a user