Commit 71773f03 authored by Mike Ditto's avatar Mike Ditto Committed by Benjamin Herrenschmidt

powerpc: Add del_node() for early boot code to prune inapplicable devices.

Some platforms have variants that can share most of a flat device tree but need
a few devices selectively pruned at boot time.  This adds del_node() to ops.h
to allow access to the existing fdt_del_node().
Signed-off-by: default avatarMike Ditto <mditto@consentry.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 201bdc86
...@@ -105,6 +105,11 @@ static int fdt_wrapper_setprop(const void *devp, const char *name, ...@@ -105,6 +105,11 @@ static int fdt_wrapper_setprop(const void *devp, const char *name,
return check_err(rc); return check_err(rc);
} }
static int fdt_wrapper_del_node(const void *devp)
{
return fdt_del_node(fdt, devp_offset(devp));
}
static void *fdt_wrapper_get_parent(const void *devp) static void *fdt_wrapper_get_parent(const void *devp)
{ {
return offset_devp(fdt_parent_offset(fdt, devp_offset(devp))); return offset_devp(fdt_parent_offset(fdt, devp_offset(devp)));
...@@ -174,6 +179,7 @@ void fdt_init(void *blob) ...@@ -174,6 +179,7 @@ void fdt_init(void *blob)
dt_ops.create_node = fdt_wrapper_create_node; dt_ops.create_node = fdt_wrapper_create_node;
dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value; dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value;
dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible; dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible;
dt_ops.del_node = fdt_wrapper_del_node;
dt_ops.get_path = fdt_wrapper_get_path; dt_ops.get_path = fdt_wrapper_get_path;
dt_ops.finalize = fdt_wrapper_finalize; dt_ops.finalize = fdt_wrapper_finalize;
......
...@@ -40,6 +40,7 @@ struct dt_ops { ...@@ -40,6 +40,7 @@ struct dt_ops {
const int buflen); const int buflen);
int (*setprop)(const void *phandle, const char *name, int (*setprop)(const void *phandle, const char *name,
const void *buf, const int buflen); const void *buf, const int buflen);
int (*del_node)(const void *phandle);
void *(*get_parent)(const void *phandle); void *(*get_parent)(const void *phandle);
/* The node must not already exist. */ /* The node must not already exist. */
void *(*create_node)(const void *parent, const char *name); void *(*create_node)(const void *parent, const char *name);
...@@ -126,6 +127,11 @@ static inline int setprop_str(void *devp, const char *name, const char *buf) ...@@ -126,6 +127,11 @@ static inline int setprop_str(void *devp, const char *name, const char *buf)
return -1; return -1;
} }
static inline int del_node(const void *devp)
{
return dt_ops.del_node ? dt_ops.del_node(devp) : -1;
}
static inline void *get_parent(const char *devp) static inline void *get_parent(const char *devp)
{ {
return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL; return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL;
......
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