public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 08/14] drm: remove include of drmP.h from bridge/dw_hdmi.h
@ 2018-12-30 17:48 ` Sam Ravnborg
  2018-12-31 10:53   ` Andrzej Hajda
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Ravnborg @ 2018-12-30 17:48 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, linux-kernel,
	dri-devel
  Cc: Sam Ravnborg, Archit Taneja, Andrzej Hajda, Kieran Bingham,
	Fabio Estevam, Neil Armstrong

drmP.h is an relic from the days when there was a single header file.
To enable the removal of drmP.h from all users drop include
of drmP.h from bridge/dw_hdmi.h.

A few files relied on the file included in drmP.h - add explicit
include statements or forward declarations to these files.
Build tested with arm and x86.

v2:
- prefer forward declarations when possible (Laurent Pinchart)
- sort include files (Laurent Pinchart)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 4 ++++
 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c              | 1 +
 include/drm/bridge/dw_hdmi.h                        | 6 ++++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
index 2228689d9a5e..5cbb71a866d5 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -5,6 +5,10 @@
  * Copyright (c) 2017 Renesas Solutions Corp.
  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  */
+
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+
 #include <drm/bridge/dw_hdmi.h>
 
 #include <sound/hdmi-codec.h>
diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
index 75490a3e0a2a..790d499daa10 100644
--- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
@@ -7,6 +7,7 @@
  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 9c56412bb2cf..9f93895dde88 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -10,9 +10,11 @@
 #ifndef __DW_HDMI__
 #define __DW_HDMI__
 
-#include <drm/drmP.h>
-
+struct drm_connector;
+struct drm_display_mode;
+struct drm_encoder;
 struct dw_hdmi;
+struct platform_device;
 
 /**
  * DOC: Supported input formats and encodings
-- 
2.12.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 08/14] drm: remove include of drmP.h from bridge/dw_hdmi.h
  2018-12-30 17:48 ` [PATCH v2 08/14] drm: remove include of drmP.h from bridge/dw_hdmi.h Sam Ravnborg
@ 2018-12-31 10:53   ` Andrzej Hajda
  0 siblings, 0 replies; 2+ messages in thread
From: Andrzej Hajda @ 2018-12-31 10:53 UTC (permalink / raw)
  To: Sam Ravnborg, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Maxime Ripard, Sean Paul, David Lechner, Laurent Pinchart,
	linux-kernel, dri-devel
  Cc: Archit Taneja, Kieran Bingham, Fabio Estevam, Neil Armstrong

On 30.12.2018 18:48, Sam Ravnborg wrote:
> drmP.h is an relic from the days when there was a single header file.
> To enable the removal of drmP.h from all users drop include
> of drmP.h from bridge/dw_hdmi.h.
>
> A few files relied on the file included in drmP.h - add explicit
> include statements or forward declarations to these files.
> Build tested with arm and x86.
>
> v2:
> - prefer forward declarations when possible (Laurent Pinchart)
> - sort include files (Laurent Pinchart)
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Andrzej Hajda <a.hajda@samsung.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> Cc: Fabio Estevam <fabio.estevam@nxp.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>


One general comment below.


> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 4 ++++
>  drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c              | 1 +
>  include/drm/bridge/dw_hdmi.h                        | 6 ++++--
>  3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> index 2228689d9a5e..5cbb71a866d5 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -5,6 +5,10 @@
>   * Copyright (c) 2017 Renesas Solutions Corp.
>   * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>   */
> +
> +#include <linux/dma-mapping.h>
> +#include <linux/module.h>
> +
>  #include <drm/bridge/dw_hdmi.h>
>  
>  #include <sound/hdmi-codec.h>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
> index 75490a3e0a2a..790d499daa10 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
> @@ -7,6 +7,7 @@
>   * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
>   */
>  
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index 9c56412bb2cf..9f93895dde88 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -10,9 +10,11 @@
>  #ifndef __DW_HDMI__
>  #define __DW_HDMI__
>  
> -#include <drm/drmP.h>
> -
> +struct drm_connector;
> +struct drm_display_mode;
> +struct drm_encoder;
>  struct dw_hdmi;
> +struct platform_device;
>  
>  /**
>   * DOC: Supported input formats and encodings


I wonder if it wouldn't be better to create common file for forward
declarations. For example: include/drm/drm_forward.h which will contain
only forward declarations, this way we could avoid adding these
declarations in every file again and again. Since I have not seen such
practice in kernel I wonder if such approach has no serious drawbacks,
but for now I do not see any, except it looks like another incarnation
of drmP.h :)

Quick grep shows potential candidates for forward declarations:

$ git grep -Ph '^struct drm_\S+;$' include/ drivers/gpu/ | sort | uniq
-c | sort -n | tail
      7 struct drm_encoder;
      7 struct drm_gem_object;
      8 struct drm_printer;
      9 struct drm_connector;
      9 struct drm_framebuffer;
     13 struct drm_plane;
     14 struct drm_crtc;
     22 struct drm_i915_private;
     23 struct drm_file;

     47 struct drm_device;


Anyway:

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

 --
Regards
Andrzej






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-31 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20181230175004epcas1p4f675fc8ea5d1073e3461d15c9dd57862@epcas1p4.samsung.com>
2018-12-30 17:48 ` [PATCH v2 08/14] drm: remove include of drmP.h from bridge/dw_hdmi.h Sam Ravnborg
2018-12-31 10:53   ` Andrzej Hajda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox