Skip to contentSkip to conversation

drm: remove include of drmP.h from bridge/dw_hdmi.h

PATCH Superseded Sam Ravnborg 2 participants 2 messages Dec 30, 2018 – Dec 31, 2018

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 8/14 drm: remove include of drmP.h from bridge/dw_hdmi.h

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)

Cc Archit Taneja <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Maxime Ripard <[email protected]>
---
 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(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +4 -0
index 2228689d9a5e..5cbb71a866d5 100644
@@ -5,6 +5,10 @@
  * Copyright (c) 2017 Renesas Solutions Corp.
  * Kuninori Morimoto <[email protected]>
  */
+
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+
 #include <drm/bridge/dw_hdmi.h>
 
 #include <sound/hdmi-codec.h>
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +1 -0
index 75490a3e0a2a..790d499daa10 100644
@@ -7,6 +7,7 @@
  * Contact: Laurent Pinchart ([email protected])
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
include/drm/bridge/dw_hdmi.h +4 -2
index 9c56412bb2cf..9f93895dde88 100644
@@ -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
Signature · 1 line
2.12.0
Reviewed-by on v2 8/14
#1 lore raw
Quoted 12 lines · Sam Ravnborg

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)

Quoted 10 lines
Cc Archit Taneja <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Maxime Ripard <[email protected]>

One general comment below.

Quoted 41 lines
---
 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(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +4 -0
index 2228689d9a5e..5cbb71a866d5 100644
@@ -5,6 +5,10 @@
  * Copyright (c) 2017 Renesas Solutions Corp.
  * Kuninori Morimoto <[email protected]>
  */
+
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+
 #include <drm/bridge/dw_hdmi.h>
 
 #include <sound/hdmi-codec.h>
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +1 -0
index 75490a3e0a2a..790d499daa10 100644
@@ -7,6 +7,7 @@
  * Contact: Laurent Pinchart ([email protected])
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
include/drm/bridge/dw_hdmi.h +0 -0
index 9c56412bb2cf..9f93895dde88 100644
@@ -10,9 +10,11 @@
 #ifndef __DW_HDMI__
 #define __DW_HDMI__
 

include/drm/bridge/dw_hdmi.h line 20

Quoted 10 lines
include/drm/bridge/dw_hdmi.h +4 -2
-#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:

 --
Regards
Andrzej