diff options
author | Mike Ditto <mditto@consentry.com> | 2008-10-21 07:32:29 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-22 00:01:21 -0400 |
commit | 71773f0337bee8a3701aaaec22581c18a5f44679 (patch) | |
tree | 06ff80057f216d0515b027b963af8a926dca8955 /arch/powerpc | |
parent | 201bdc868d9e3122bbe4491aa6b5fc4dee4cdb96 (diff) |
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: Mike Ditto <mditto@consentry.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/boot/libfdt-wrapper.c | 6 | ||||
-rw-r--r-- | arch/powerpc/boot/ops.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c index 1daa73f08ba8..9276327bc2bb 100644 --- a/arch/powerpc/boot/libfdt-wrapper.c +++ b/arch/powerpc/boot/libfdt-wrapper.c | |||
@@ -105,6 +105,11 @@ static int fdt_wrapper_setprop(const void *devp, const char *name, | |||
105 | return check_err(rc); | 105 | return check_err(rc); |
106 | } | 106 | } |
107 | 107 | ||
108 | static int fdt_wrapper_del_node(const void *devp) | ||
109 | { | ||
110 | return fdt_del_node(fdt, devp_offset(devp)); | ||
111 | } | ||
112 | |||
108 | static void *fdt_wrapper_get_parent(const void *devp) | 113 | static void *fdt_wrapper_get_parent(const void *devp) |
109 | { | 114 | { |
110 | return offset_devp(fdt_parent_offset(fdt, devp_offset(devp))); | 115 | return offset_devp(fdt_parent_offset(fdt, devp_offset(devp))); |
@@ -174,6 +179,7 @@ void fdt_init(void *blob) | |||
174 | dt_ops.create_node = fdt_wrapper_create_node; | 179 | dt_ops.create_node = fdt_wrapper_create_node; |
175 | dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value; | 180 | dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value; |
176 | dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible; | 181 | dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible; |
182 | dt_ops.del_node = fdt_wrapper_del_node; | ||
177 | dt_ops.get_path = fdt_wrapper_get_path; | 183 | dt_ops.get_path = fdt_wrapper_get_path; |
178 | dt_ops.finalize = fdt_wrapper_finalize; | 184 | dt_ops.finalize = fdt_wrapper_finalize; |
179 | 185 | ||
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h index 321e2f5afe71..b3218ce451bb 100644 --- a/arch/powerpc/boot/ops.h +++ b/arch/powerpc/boot/ops.h | |||
@@ -40,6 +40,7 @@ struct dt_ops { | |||
40 | const int buflen); | 40 | const int buflen); |
41 | int (*setprop)(const void *phandle, const char *name, | 41 | int (*setprop)(const void *phandle, const char *name, |
42 | const void *buf, const int buflen); | 42 | const void *buf, const int buflen); |
43 | int (*del_node)(const void *phandle); | ||
43 | void *(*get_parent)(const void *phandle); | 44 | void *(*get_parent)(const void *phandle); |
44 | /* The node must not already exist. */ | 45 | /* The node must not already exist. */ |
45 | void *(*create_node)(const void *parent, const char *name); | 46 | 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 | return -1; | 127 | return -1; |
127 | } | 128 | } |
128 | 129 | ||
130 | static inline int del_node(const void *devp) | ||
131 | { | ||
132 | return dt_ops.del_node ? dt_ops.del_node(devp) : -1; | ||
133 | } | ||
134 | |||
129 | static inline void *get_parent(const char *devp) | 135 | static inline void *get_parent(const char *devp) |
130 | { | 136 | { |
131 | return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL; | 137 | return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL; |