Skip to contentSkip to conversation

drm: always provide debugfs function prototypes

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 21, 2013 – Jun 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: always provide debugfs function prototypes

It is generally considered bad style to enclose function prototypes in header files in #ifdef. This case illustrates why that is:
The tegra host1x driver calls into the debugfs functions if CONFIG_DEBUG_FS is enabled, but that code is otherwise already discarded by the compiler, so leaving the prototype in place actually makes everything work.

drivers/gpu/host1x/drm/dc.c: In function 'tegra_dc_debugfs_init':
drivers/gpu/host1x/drm/dc.c:1004:2: error: implicit declaration of function 'drm_debugfs_create_files' [-Werror=implicit-function-declaration]
drivers/gpu/host1x/drm/dc.c: In function 'tegra_dc_debugfs_exit': drivers/gpu/host1x/drm/dc.c:1026:2: error: implicit declaration of function 'drm_debugfs_remove_files' [-Werror=implicit-function-declaration]

Cc Ben Gamari <[email protected]>
Cc Dave Airlie <[email protected]>
include/drm/drmP.h +1 -2
index 63d17ee..8bc105e 100644
@@ -1551,7 +1551,7 @@ extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root);
 extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
 
 				/* Debugfs support */
-#if defined(CONFIG_DEBUG_FS)
+
 extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 			    struct dentry *root);
 extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
@@ -1559,7 +1559,6 @@ extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
 extern int drm_debugfs_remove_files(struct drm_info_list *files, int count,
                                     struct drm_minor *minor);
 extern int drm_debugfs_cleanup(struct drm_minor *minor);
-#endif
 
 				/* Info file support */
 extern int drm_name_info(struct seq_file *m, void *data);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Arnd Bergmann

It is generally considered bad style to enclose function prototypes in header files in #ifdef. This case illustrates why that is:
The tegra host1x driver calls into the debugfs functions if CONFIG_DEBUG_FS is enabled, but that code is otherwise already discarded by the compiler, so leaving the prototype in place actually makes everything work.

drivers/gpu/host1x/drm/dc.c: In function 'tegra_dc_debugfs_init':
drivers/gpu/host1x/drm/dc.c:1004:2: error: implicit declaration of function 'drm_debugfs_create_files' [-Werror=implicit-function-declaration]
drivers/gpu/host1x/drm/dc.c: In function 'tegra_dc_debugfs_exit': drivers/gpu/host1x/drm/dc.c:1026:2: error: implicit declaration of function 'drm_debugfs_remove_files' [-Werror=implicit-function-declaration]

Cc Ben Gamari <[email protected]>
Cc Dave Airlie <[email protected]>
include/drm/drmP.h +0 -0
index 63d17ee..8bc105e 100644

include/drm/drmP.h extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root); · line 1554

Quoted 5 lines
include/drm/drmP.h +1 -1
@@ -1551,7 +1551,7 @@ extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root);
 extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
 
 				/* Debugfs support */
-#if defined(CONFIG_DEBUG_FS)
+

I don't know what good the blank line does here, but apart from that this patch looks good to me: