Commit d3b814bb authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[POWERPC] Generalise device_node flag interface

The struct device_node currently has a _flags variable, although
it's only used for one flag - OF_DYNAMIC.  Generalise the flag
accessors so we can use them with other flags in future.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 972d17c9
...@@ -1375,7 +1375,7 @@ static void of_node_release(struct kref *kref) ...@@ -1375,7 +1375,7 @@ static void of_node_release(struct kref *kref)
struct device_node *node = kref_to_device_node(kref); struct device_node *node = kref_to_device_node(kref);
struct property *prop = node->properties; struct property *prop = node->properties;
if (!OF_IS_DYNAMIC(node)) if (!of_node_check_flag(node, OF_DYNAMIC))
return; return;
while (prop) { while (prop) {
struct property *next = prop->next; struct property *next = prop->next;
......
...@@ -123,7 +123,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist ...@@ -123,7 +123,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
strcpy(np->full_name, path); strcpy(np->full_name, path);
np->properties = proplist; np->properties = proplist;
OF_MARK_DYNAMIC(np); of_node_set_flag(np, OF_DYNAMIC);
kref_init(&np->kref); kref_init(&np->kref);
np->parent = derive_parent(path); np->parent = derive_parent(path);
......
...@@ -98,10 +98,18 @@ struct device_node { ...@@ -98,10 +98,18 @@ struct device_node {
extern struct device_node *of_chosen; extern struct device_node *of_chosen;
/* flag descriptions */ /* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
{
return test_bit(flag, &n->_flags);
}
static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
{
set_bit(flag, &n->_flags);
}
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
#define HAVE_ARCH_DEVTREE_FIXUPS #define HAVE_ARCH_DEVTREE_FIXUPS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment