diff mbox series

[v1,01/10] drm: fix build errors with drm_print.h

Message ID 20190609220757.10862-2-sam@ravnborg.org (mailing list archive)
State New, archived
Headers show
Series drm/amd: drop use of drmP.h | expand

Commit Message

Sam Ravnborg June 9, 2019, 10:07 p.m. UTC
drm_print.h requires <drm/drm.h> to fix build when macros are used.
Pull in the header file in drm_print.h so users do not have to do it.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 include/drm/drm_print.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel Vetter June 11, 2019, 8:39 a.m. UTC | #1
On Mon, Jun 10, 2019 at 12:07:48AM +0200, Sam Ravnborg wrote:
> drm_print.h requires <drm/drm.h> to fix build when macros are used.
> Pull in the header file in drm_print.h so users do not have to do it.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  include/drm/drm_print.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 3a4247319e63..a5d6f2f3e430 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -32,6 +32,8 @@
>  #include <linux/device.h>
>  #include <linux/debugfs.h>
>  
> +#include <drm/drm.h>

What goes boom without this? Only drm/drm.h that I could find was the one
in uapi/drm/drm.h, and that one looks very fishy to include from an
internal helper header like print.h.
-Daniel

> +
>  /**
>   * DOC: print
>   *
> -- 
> 2.20.1
>
Sam Ravnborg June 11, 2019, 9:11 a.m. UTC | #2
Hi Daniel.

On Tue, Jun 11, 2019 at 10:39:11AM +0200, Daniel Vetter wrote:
> On Mon, Jun 10, 2019 at 12:07:48AM +0200, Sam Ravnborg wrote:
> > drm_print.h requires <drm/drm.h> to fix build when macros are used.
> > Pull in the header file in drm_print.h so users do not have to do it.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >  include/drm/drm_print.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > index 3a4247319e63..a5d6f2f3e430 100644
> > --- a/include/drm/drm_print.h
> > +++ b/include/drm/drm_print.h
> > @@ -32,6 +32,8 @@
> >  #include <linux/device.h>
> >  #include <linux/debugfs.h>
> >  
> > +#include <drm/drm.h>
> 
> What goes boom without this? Only drm/drm.h that I could find was the one
> in uapi/drm/drm.h, and that one looks very fishy to include from an
> internal helper header like print.h.

drm_print.h uses DRM_NAME - which is defined only in uapi/drm/drm.h.
The error is seen when you include drm_print.h and not much other drm
header files.
Tiday we rely on other drm header files to pull in drm.h.

Notice - the error only manifest itself when the macros are used.
Including the drm_print.h will not do it.

	Sam
Daniel Vetter June 11, 2019, 9:42 a.m. UTC | #3
On Tue, Jun 11, 2019 at 11:11:07AM +0200, Sam Ravnborg wrote:
> Hi Daniel.
> 
> On Tue, Jun 11, 2019 at 10:39:11AM +0200, Daniel Vetter wrote:
> > On Mon, Jun 10, 2019 at 12:07:48AM +0200, Sam Ravnborg wrote:
> > > drm_print.h requires <drm/drm.h> to fix build when macros are used.
> > > Pull in the header file in drm_print.h so users do not have to do it.
> > > 
> > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > > Cc: Sean Paul <sean@poorly.run>
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > ---
> > >  include/drm/drm_print.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > > index 3a4247319e63..a5d6f2f3e430 100644
> > > --- a/include/drm/drm_print.h
> > > +++ b/include/drm/drm_print.h
> > > @@ -32,6 +32,8 @@
> > >  #include <linux/device.h>
> > >  #include <linux/debugfs.h>
> > >  
> > > +#include <drm/drm.h>
> > 
> > What goes boom without this? Only drm/drm.h that I could find was the one
> > in uapi/drm/drm.h, and that one looks very fishy to include from an
> > internal helper header like print.h.
> 
> drm_print.h uses DRM_NAME - which is defined only in uapi/drm/drm.h.
> The error is seen when you include drm_print.h and not much other drm
> header files.
> Tiday we rely on other drm header files to pull in drm.h.
> 
> Notice - the error only manifest itself when the macros are used.
> Including the drm_print.h will not do it.

Uh, I think let's just inline DRM_NAME, that also cleans up the code. And
drop the uapi include from drm internal headers, that feels bad. In
general I think uapi headers should only be included by the .c files that
actually implement ioctls and stuff like that.

Can you pls do that patch for drm_print.h?

Thanks, Daniel
Sam Ravnborg June 11, 2019, 10:37 a.m. UTC | #4
Hi Daniel.

> > 
> > drm_print.h uses DRM_NAME - which is defined only in uapi/drm/drm.h.
> > The error is seen when you include drm_print.h and not much other drm
> > header files.
> > Tiday we rely on other drm header files to pull in drm.h.
> > 
> > Notice - the error only manifest itself when the macros are used.
> > Including the drm_print.h will not do it.
> 
> Uh, I think let's just inline DRM_NAME, that also cleans up the code. And
> drop the uapi include from drm internal headers, that feels bad. In
> general I think uapi headers should only be included by the .c files that
> actually implement ioctls and stuff like that.
> 
> Can you pls do that patch for drm_print.h?

Yep - will do in a few days.

	Sam
diff mbox series

Patch

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 3a4247319e63..a5d6f2f3e430 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -32,6 +32,8 @@ 
 #include <linux/device.h>
 #include <linux/debugfs.h>
 
+#include <drm/drm.h>
+
 /**
  * DOC: print
  *