diff mbox

powerpc: Add del_node function to allow early boot code to prune inapplicable devices.

Message ID 48FE4A6D.5@consentry.com (mailing list archive)
State Accepted, archived
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Mike Ditto Oct. 21, 2008, 9:32 p.m. UTC
Reposting in proper format...

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>
---

Comments

Grant Likely Oct. 21, 2008, 11:33 p.m. UTC | #1
On Tue, Oct 21, 2008 at 02:32:29PM -0700, Mike Ditto wrote:
> Reposting in proper format...
> 
> 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>

Looks good to me.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> 
> Index: arch/powerpc/boot/ops.h
> ===================================================================
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 ops.h
> --- arch/powerpc/boot/ops.h	11 Oct 2008 02:51:35 -0000	1.1.1.1
> +++ arch/powerpc/boot/ops.h	18 Oct 2008 02:06:45 -0000
> @@ -40,6 +40,7 @@
>  			const int buflen);
>  	int	(*setprop)(const void *phandle, const char *name,
>  			const void *buf, const int buflen);
> +	int (*del_node)(const void *phandle);
>  	void *(*get_parent)(const void *phandle);
>  	/* The node must not already exist. */
>  	void *(*create_node)(const void *parent, const char *name);
> @@ -124,6 +125,11 @@
>  		return dt_ops.setprop(devp, name, buf, strlen(buf) + 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)
> Index: arch/powerpc/boot/libfdt-wrapper.c
> ===================================================================
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 libfdt-wrapper.c
> --- arch/powerpc/boot/libfdt-wrapper.c	11 Oct 2008 02:51:35 -0000	1.1.1.1
> +++ arch/powerpc/boot/libfdt-wrapper.c	17 Oct 2008 22:08:44 -0000
> @@ -105,6 +105,11 @@
>  	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)
>  {
>  	return offset_devp(fdt_parent_offset(fdt, devp_offset(devp)));
> @@ -173,6 +178,7 @@
>  	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_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.finalize = fdt_wrapper_finalize;
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
David Gibson Oct. 22, 2008, 12:09 a.m. UTC | #2
On Tue, Oct 21, 2008 at 02:32:29PM -0700, Mike Ditto wrote:
> Reposting in proper format...
> 
> 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>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Benjamin Herrenschmidt Oct. 22, 2008, 12:23 a.m. UTC | #3
On Tue, 2008-10-21 at 17:33 -0600, Grant Likely wrote:
> On Tue, Oct 21, 2008 at 02:32:29PM -0700, Mike Ditto wrote:
> > Reposting in proper format...
> > 
> > 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>
> 
> Looks good to me.
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

little nit: The patch doesn't quite have the right form.

Patches to the kernel are expected to apply with -p1, so
for example, the patch line contains:

arch/powerpc/boot/ops.h

It should be

something/arch/powerpc/boot/ops.h

I've fixed it up manually so no need to re-submit, but you'll know next
time :-)

Cheers,
Ben.
Mike Ditto Oct. 22, 2008, 12:25 a.m. UTC | #4
Benjamin Herrenschmidt wrote:
> I've fixed it up manually so no need to re-submit, but you'll know next
> time :-)

Thanks!
					-=] Mike [=-
diff mbox

Patch

Index: arch/powerpc/boot/ops.h
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ops.h
--- arch/powerpc/boot/ops.h	11 Oct 2008 02:51:35 -0000	1.1.1.1
+++ arch/powerpc/boot/ops.h	18 Oct 2008 02:06:45 -0000
@@ -40,6 +40,7 @@ 
 			const int buflen);
 	int	(*setprop)(const void *phandle, const char *name,
 			const void *buf, const int buflen);
+	int (*del_node)(const void *phandle);
 	void *(*get_parent)(const void *phandle);
 	/* The node must not already exist. */
 	void *(*create_node)(const void *parent, const char *name);
@@ -124,6 +125,11 @@ 
 		return dt_ops.setprop(devp, name, buf, strlen(buf) + 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)
Index: arch/powerpc/boot/libfdt-wrapper.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 libfdt-wrapper.c
--- arch/powerpc/boot/libfdt-wrapper.c	11 Oct 2008 02:51:35 -0000	1.1.1.1
+++ arch/powerpc/boot/libfdt-wrapper.c	17 Oct 2008 22:08:44 -0000
@@ -105,6 +105,11 @@ 
 	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)
 {
 	return offset_devp(fdt_parent_offset(fdt, devp_offset(devp)));
@@ -173,6 +178,7 @@ 
 	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_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.finalize = fdt_wrapper_finalize;