Patchwork [1/9] of: move phandle/ihandle into types.h

login
register
mail settings
Submitter Andres Salomon
Date Aug. 30, 2010, 3:53 a.m.
Message ID <20100829235352.1744e7e3@debxo>
Download mbox | patch
Permalink /patch/62986/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Andres Salomon - Aug. 30, 2010, 3:53 a.m.
We need phandle for some exported sparc headers; of.h isn't an
exported header, and it would be silly to export it when all we
really need is one or two types from it.  So, move the phandle/ihandle
definitions into types.h.

Signed-off-by: Andres Salomon <dilinger@queued.net>
---
 include/linux/of.h    |    3 ---
 include/linux/types.h |    4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)
Sam Ravnborg - Aug. 30, 2010, 5:06 a.m.
On Sun, Aug 29, 2010 at 11:53:52PM -0400, Andres Salomon wrote:
> 
> We need phandle for some exported sparc headers; of.h isn't an
> exported header, and it would be silly to export it when all we
> really need is one or two types from it.  So, move the phandle/ihandle
> definitions into types.h.
> 
> diff --git a/include/linux/types.h b/include/linux/types.h
> index 01a082f..26526ea 100644
> --- a/include/linux/types.h
> +++ b/include/linux/types.h
> @@ -219,6 +219,10 @@ struct ustat {
>  	char			f_fpack[6];
>  };
>  
> +/* Basic openboot/openfirmware types */
> +typedef u32 phandle;
> +typedef u32 ihandle;
> +
>  #endif	/* __KERNEL__ */

The above is inside #ifdef __KERNEL__ / #endif
so it is not exported as we drop code protected
by __KERNEL__ when we prepare for export.

Id addition "phandle" and "ihandle" needs to have
two underscores apended as we cannot just add the above
to the userspace namespace and expect it to be OK.

We do this for many other typers already, see __u32 for example.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andres Salomon - Sept. 3, 2010, 8:17 a.m.
On Mon, 30 Aug 2010 07:06:27 +0200
Sam Ravnborg <sam@ravnborg.org> wrote:

> On Sun, Aug 29, 2010 at 11:53:52PM -0400, Andres Salomon wrote:
> > 
> > We need phandle for some exported sparc headers; of.h isn't an
> > exported header, and it would be silly to export it when all we
> > really need is one or two types from it.  So, move the
> > phandle/ihandle definitions into types.h.
> > 
> > diff --git a/include/linux/types.h b/include/linux/types.h
> > index 01a082f..26526ea 100644
> > --- a/include/linux/types.h
> > +++ b/include/linux/types.h
> > @@ -219,6 +219,10 @@ struct ustat {
> >  	char			f_fpack[6];
> >  };
> >  
> > +/* Basic openboot/openfirmware types */
> > +typedef u32 phandle;
> > +typedef u32 ihandle;
> > +
> >  #endif	/* __KERNEL__ */
> 
> The above is inside #ifdef __KERNEL__ / #endif
> so it is not exported as we drop code protected
> by __KERNEL__ when we prepare for export.



At least for me, that's fine; I don't need phandle/ihandle to be
available to userspace.  The folks who work on the userspace fdt code
may feel differently, however.

(I'm not sure if you're suggesting it be outside the __KERNEL__ ifdef
or not..)

> 
> Id addition "phandle" and "ihandle" needs to have
> two underscores apended as we cannot just add the above
> to the userspace namespace and expect it to be OK.
> 
> We do this for many other typers already, see __u32 for example.
> 
> 	Sam

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg - Sept. 5, 2010, 6:22 a.m.
On Fri, Sep 03, 2010 at 04:17:15AM -0400, Andres Salomon wrote:
> On Mon, 30 Aug 2010 07:06:27 +0200
> Sam Ravnborg <sam@ravnborg.org> wrote:
> 
> > On Sun, Aug 29, 2010 at 11:53:52PM -0400, Andres Salomon wrote:
> > > 
> > > We need phandle for some exported sparc headers; of.h isn't an
> > > exported header, and it would be silly to export it when all we
> > > really need is one or two types from it.  So, move the
> > > phandle/ihandle definitions into types.h.
> > > 
> > > diff --git a/include/linux/types.h b/include/linux/types.h
> > > index 01a082f..26526ea 100644
> > > --- a/include/linux/types.h
> > > +++ b/include/linux/types.h
> > > @@ -219,6 +219,10 @@ struct ustat {
> > >  	char			f_fpack[6];
> > >  };
> > >  
> > > +/* Basic openboot/openfirmware types */
> > > +typedef u32 phandle;
> > > +typedef u32 ihandle;
> > > +
> > >  #endif	/* __KERNEL__ */
> > 
> > The above is inside #ifdef __KERNEL__ / #endif
> > so it is not exported as we drop code protected
> > by __KERNEL__ when we prepare for export.
> 
> 
> 
> At least for me, that's fine; I don't need phandle/ihandle to be
> available to userspace.  The folks who work on the userspace fdt code
> may feel differently, however.
> 
> (I'm not sure if you're suggesting it be outside the __KERNEL__ ifdef
> or not..)

If the goal is to get ihandle/phandle exported to userspace then
they have to be moved outside __KERNEL__.

I just tried to export sparc64 headers,
and here I found references to ihandle/phandle in a comment
only sparc does not need these types today.

The relevant function took and returns an int btw.

So the above looks good considerign that userspace
so far does not require ihanlde/phandle.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/of.h b/include/linux/of.h
index cad7cf0..db184dc 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -25,9 +25,6 @@ 
 
 #ifdef CONFIG_OF
 
-typedef u32 phandle;
-typedef u32 ihandle;
-
 struct property {
 	char	*name;
 	int	length;
diff --git a/include/linux/types.h b/include/linux/types.h
index 01a082f..26526ea 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -219,6 +219,10 @@  struct ustat {
 	char			f_fpack[6];
 };
 
+/* Basic openboot/openfirmware types */
+typedef u32 phandle;
+typedef u32 ihandle;
+
 #endif	/* __KERNEL__ */
 #endif /*  __ASSEMBLY__ */
 #endif /* _LINUX_TYPES_H */