drm: headers: Add neccessary include files and guards
Subsystems (2)
PATCH 1/1 drm: headers: Add neccessary include files and guards
Otherwise gcc will complain about unknown types, and declarations inside parameter lists, if "drm_internal.h" is used in C files with less headers than what's now typically done under drivers/gpu/drm/.
---
Notes:
This was triggered by the in-development drm-panic code.
drivers/gpu/drm/drm_crtc_helper_internal.h | 5 +++++ drivers/gpu/drm/drm_crtc_internal.h | 5 +++++ drivers/gpu/drm/drm_internal.h | 12 ++++++++++++ include/drm/drm_auth.h | 9 +++++++++ 4 files changed, 31 insertions(+)
drivers/gpu/drm/drm_crtc_helper_internal.h +5 -0
@@ -20,6 +20,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_CRTC_HELPER_INTERNAL_H +#define _DRM_CRTC_HELPER_INTERNAL_H +/* * This header file contains mode setting related functions and definitions * which are only used within the drm kms helper module as internal
@@ -75,3 +78,5 @@ enum drm_mode_status drm_encoder_mode_valid(struct drm_encoder *encoder, const struct drm_display_mode *mode);enum drm_mode_status drm_connector_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode); + +#endif /* _DRM_CRTC_HELPER_INTERNAL_H */
drivers/gpu/drm/drm_crtc_internal.h +5 -0
@@ -25,6 +25,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_CRTC_INTERNAL_H +#define _DRM_CRTC_INTERNAL_H +/* * This header file contains mode setting related functions and definitions * which are only used within the drm module as internal implementation details
@@ -252,3 +255,5 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,void drm_mode_fixup_1366x768 (struct drm_display_mode *mode);void drm_reset_display_info (struct drm_connector *connector);u32 drm_add_display_info (struct drm_connector *connector,const struct edid *edid); + +#endif /* _DRM_CRTC_INTERNAL_H */
drivers/gpu/drm/drm_internal.h +12 -0
@@ -21,7 +21,17 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_INTERNAL_H +#define _DRM_INTERNAL_H + +#include <linux/mutex.h> + +#include <drm/drm_auth.h> +#include <drm/drm_connector.h> +#include <drm/drm_device.h> +#include <drm/drm_file.h> #include <drm/drm_ioctl.h> +#include <drm/drm_print.h> #define DRM_IF_MAJOR 1#define DRM_IF_MINOR 4
@@ -191,3 +201,5 @@ int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,void drm_framebuffer_print_info (struct drm_printer *p,unsigned int indent,const struct drm_framebuffer *fb);int drm_framebuffer_debugfs_init (struct drm_minor *minor); + +#endif /* _DRM_INTERNAL_H */
include/drm/drm_auth.h +9 -0
@@ -28,6 +28,15 @@#ifndef _DRM_AUTH_H_#define _DRM_AUTH_H_ +#include <linux/kref.h> +#include <linux/idr.h> +#include <linux/wait.h> + +#include <uapi/drm/drm.h> + +#include <drm/drm_device.h> +#include <drm/drm_file.h> +/* * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for * include ordering reasons.
--
darwi
http://darwish.chasingpointers.com
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines · Ahmed S. Darwish
Otherwise gcc will complain about unknown types, and declarations inside parameter lists, if "
drm_internal.h" is used in C files with less headers than what's now typically done underdrivers/gpu/drm/.Signed-off-by Ahmed S. Darwish <[email protected]>---
Notes:
This was triggered by the in-development drm-panic code.drivers/gpu/drm/drm_crtc_helper_internal.h | 5 +++++ drivers/gpu/drm/drm_crtc_internal.h | 5 +++++ drivers/gpu/drm/drm_internal.h | 12 ++++++++++++ include/drm/drm_auth.h | 9 +++++++++ 4 files changed, 31 insertions(+)drivers/gpu/drm/drm_crtc_helper_internal.h +0
-0
drivers/gpu/drm/drm_crtc_helper_internal.h line 24
Quoted 5 lines
drivers/gpu/drm/drm_crtc_helper_internal.h +2
-0@@ -20,6 +20,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_CRTC_HELPER_INTERNAL_H +#define _DRM_CRTC_HELPER_INTERNAL_H
I'm kinda wondering how you managed to include these multiple times?
Quoted 39 lines
drivers/gpu/drm/drm_crtc_helper_internal.h +3
-0+/* * This header file contains mode setting related functions and definitions * which are only used within the drm kms helper module as internal @@ -75,3 +78,5 @@ enum drm_mode_status drm_encoder_mode_valid(struct drm_encoder *encoder, const struct drm_display_mode *mode);enum drm_mode_status drm_connector_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode); + +#endif /* _DRM_CRTC_HELPER_INTERNAL_H */ drivers/gpu/drm/drm_crtc_internal.h +5
-0@@ -25,6 +25,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_CRTC_INTERNAL_H +#define _DRM_CRTC_INTERNAL_H +/* * This header file contains mode setting related functions and definitions * which are only used within the drm module as internal implementation details @@ -252,3 +255,5 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,void drm_mode_fixup_1366x768 (struct drm_display_mode *mode);void drm_reset_display_info (struct drm_connector *connector);u32 drm_add_display_info (struct drm_connector *connector,const struct edid *edid); + +#endif /* _DRM_CRTC_INTERNAL_H */ drivers/gpu/drm/drm_internal.h +1
-0@@ -21,7 +21,17 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_INTERNAL_H
drivers/gpu/drm/drm_internal.h line 34
Quoted 10 lines
drivers/gpu/drm/drm_internal.h +9
-0+#define _DRM_INTERNAL_H + +#include <linux/mutex.h> + +#include <drm/drm_auth.h> +#include <drm/drm_connector.h> +#include <drm/drm_device.h> +#include <drm/drm_file.h> #include <drm/drm_ioctl.h> +#include <drm/drm_print.h>
If you only need these for the structures used in pointers, then please use forward declarations, don't pull in the entire thing.
I'm also wondering whether we actually need drm_ioctl.h, or whether a few forward decls would be good enough.
Quoted 15 lines
drivers/gpu/drm/drm_internal.h +2
-0#define DRM_IF_MAJOR 1#define DRM_IF_MINOR 4@@ -191,3 +201,5 @@ int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,void drm_framebuffer_print_info (struct drm_printer *p,unsigned int indent,const struct drm_framebuffer *fb);int drm_framebuffer_debugfs_init (struct drm_minor *minor); + +#endif /* _DRM_INTERNAL_H */ include/drm/drm_auth.h +0
-0@@ -28,6 +28,15 @@#ifndef _DRM_AUTH_H_
include/drm/drm_auth.h line 38
Quoted 10 lines
include/drm/drm_auth.h +8
-0#define _DRM_AUTH_H_ +#include <linux/kref.h> +#include <linux/idr.h> +#include <linux/wait.h> + +#include <uapi/drm/drm.h> + +#include <drm/drm_device.h> +#include <drm/drm_file.h>
Same comment about forward decls. Plus it would be good to also clean up drm_auth.c, i.e. drop the drmP.h include and put the drm_auth.h include as the very first one. To make sure the header is now working correctly stand-alone.
-Daniel
Quoted 8 lines
include/drm/drm_auth.h +1
-1+/* * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for * include ordering reasons. --
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 25 lines · Daniel Vetter
Quoted 24 lines · Ahmed S. Darwish
Otherwise gcc will complain about unknown types, and declarations inside parameter lists, if "
drm_internal.h" is used in C files with less headers than what's now typically done underdrivers/gpu/drm/.Signed-off-by Ahmed S. Darwish <[email protected]>---
Notes:
This was triggered by the in-development drm-panic code.drivers/gpu/drm/drm_crtc_helper_internal.h | 5 +++++ drivers/gpu/drm/drm_crtc_internal.h | 5 +++++ drivers/gpu/drm/drm_internal.h | 12 ++++++++++++ include/drm/drm_auth.h | 9 +++++++++ 4 files changed, 31 insertions(+)drivers/gpu/drm/drm_crtc_helper_internal.h +0
-0@@ -20,6 +20,9 @@* OTHER DEALINGS IN THE SOFTWARE. */
Quoted 5 lines
drivers/gpu/drm/drm_crtc_helper_internal.h line 24
Quoted 2 lines
drivers/gpu/drm/drm_crtc_helper_internal.h +2
-0+#ifndef _DRM_CRTC_HELPER_INTERNAL_H +#define _DRM_CRTC_HELPER_INTERNAL_HI'm kinda wondering how you managed to include these multiple times?
Oh, this was only added for completeness / consistency. The actual errors triggered are the missing declarations.
Quoted 53 lines
Quoted 39 lines
drivers/gpu/drm/drm_crtc_helper_internal.h +3
-0+/* * This header file contains mode setting related functions and definitions * which are only used within the drm kms helper module as internal @@ -75,3 +78,5 @@ enum drm_mode_status drm_encoder_mode_valid(struct drm_encoder *encoder, const struct drm_display_mode *mode);enum drm_mode_status drm_connector_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode); + +#endif /* _DRM_CRTC_HELPER_INTERNAL_H */ drivers/gpu/drm/drm_crtc_internal.h +5
-0@@ -25,6 +25,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_CRTC_INTERNAL_H +#define _DRM_CRTC_INTERNAL_H +/* * This header file contains mode setting related functions and definitions * which are only used within the drm module as internal implementation details @@ -252,3 +255,5 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,void drm_mode_fixup_1366x768 (struct drm_display_mode *mode);void drm_reset_display_info (struct drm_connector *connector);u32 drm_add_display_info (struct drm_connector *connector,const struct edid *edid); + +#endif /* _DRM_CRTC_INTERNAL_H */ drivers/gpu/drm/drm_internal.h +1
-0@@ -21,7 +21,17 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DRM_INTERNAL_Hdrivers/gpu/drm/drm_internal.h line 34
Quoted 10 lines
drivers/gpu/drm/drm_internal.h +9
-0+#define _DRM_INTERNAL_H + +#include <linux/mutex.h> + +#include <drm/drm_auth.h> +#include <drm/drm_connector.h> +#include <drm/drm_device.h> +#include <drm/drm_file.h> #include <drm/drm_ioctl.h> +#include <drm/drm_print.h> If you only need these for the structures used in pointers, then please use forward declarations, don't pull in the entire thing.
Quoted 3 lines
I'm also wondering whether we actually need
drm_ioctl.h, or whether a few forward decls would be good enough.
Oh, I see, forward decls then .. let's drop this.
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_internal.h +2
-0#define DRM_IF_MAJOR 1#define DRM_IF_MINOR 4@@ -191,3 +201,5 @@ int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,void drm_framebuffer_print_info (struct drm_printer *p,unsigned int indent,const struct drm_framebuffer *fb);int drm_framebuffer_debugfs_init (struct drm_minor *minor); + +#endif /* _DRM_INTERNAL_H */ include/drm/drm_auth.h +0
-0@@ -28,6 +28,15 @@#ifndef _DRM_AUTH_H_#define _DRM_AUTH_H_
Quoted 14 lines
include/drm/drm_auth.h line 38
Quoted 8 lines
include/drm/drm_auth.h +8
-0+#include <linux/kref.h> +#include <linux/idr.h> +#include <linux/wait.h> + +#include <uapi/drm/drm.h> + +#include <drm/drm_device.h> +#include <drm/drm_file.h> Same comment about forward decls. Plus it would be good to also clean up
drm_auth.c, i.e. drop thedrmP.hinclude and put thedrm_auth.hinclude as the very first one. To make sure the header is now working correctly stand-alone.
will do.
Quoted 2 lines
-Daniel
thanks,
--darwi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel