Skip to content

Commit 71773f0

Browse files
Mike Dittoozbenh
authored andcommitted
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>
1 parent 201bdc8 commit 71773f0

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎arch/powerpc/boot/libfdt-wrapper.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ static int fdt_wrapper_setprop(const void *devp, const char *name,
105105
return check_err(rc);
106106
}
107107

108+
static int fdt_wrapper_del_node(const void *devp)
109+
{
110+
return fdt_del_node(fdt, devp_offset(devp));
111+
}
112+
108113
static void *fdt_wrapper_get_parent(const void *devp)
109114
{
110115
return offset_devp(fdt_parent_offset(fdt, devp_offset(devp)));
@@ -174,6 +179,7 @@ void fdt_init(void *blob)
174179
dt_ops.create_node = fdt_wrapper_create_node;
175180
dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value;
176181
dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible;
182+
dt_ops.del_node = fdt_wrapper_del_node;
177183
dt_ops.get_path = fdt_wrapper_get_path;
178184
dt_ops.finalize = fdt_wrapper_finalize;
179185

‎arch/powerpc/boot/ops.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct dt_ops {
4040
const int buflen);
4141
int (*setprop)(const void *phandle, const char *name,
4242
const void *buf, const int buflen);
43+
int (*del_node)(const void *phandle);
4344
void *(*get_parent)(const void *phandle);
4445
/* The node must not already exist. */
4546
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)
126127
return -1;
127128
}
128129

130+
static inline int del_node(const void *devp)
131+
{
132+
return dt_ops.del_node ? dt_ops.del_node(devp) : -1;
133+
}
134+
129135
static inline void *get_parent(const char *devp)
130136
{
131137
return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL;

0 commit comments

Comments
 (0)