Skip to contentSkip to conversation

gpu/drm/amdgpu: Include <linux/debugfs.h> only if CONFIG_DEBUG_FS is set

PATCH In review Alexander Kuleshov 3 participants 5 messages Jul 13, 2015 – Jul 14, 2015

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

PATCH 1/1 gpu/drm/amdgpu: Include <linux/debugfs.h> only if CONFIG_DEBUG_FS is set

We have no need to include <linux/debugfs.h> if the CONFIG_DEBUG_FS option is not set.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
index ba46be3..23dbfa4 100644
@@ -27,7 +27,6 @@
  */
 #include <linux/console.h>
 #include <linux/slab.h>
-#include <linux/debugfs.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/amdgpu_drm.h>
@@ -44,2 +43,2 @@
 #include "vi.h"
 #include "bif/bif_4_1_d.h"

+#ifdef CONFIG_DEBUG_FS
+#include <linux/debugfs.h>
+#endif
+
static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev); static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);

--
2.5.0-rc1

#1 lore raw
Quoted 3 lines · Alexander Kuleshov

We have no need to include <linux/debugfs.h> if the CONFIG_DEBUG_FS option is not set.

This patch breaks the build with debugfs enabled.

Alex

Quoted 31 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -2
index ba46be3..23dbfa4 100644
@@ -27,7 +27,6 @@
  */
 #include <linux/console.h>
 #include <linux/slab.h>
-#include <linux/debugfs.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/amdgpu_drm.h>
@@ -44,2 +43,2 @@
 #include "vi.h"
 #include "bif/bif_4_1_d.h"
 
+#ifdef CONFIG_DEBUG_FS
+#include <linux/debugfs.h>
+#endif
+
 static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
 static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
 
--

2.5.0-rc1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hello Alex,

2015-07-14 11:11 GMT+06:00 Alex Deucher <[email protected]>:

Quoted 3 lines

This patch breaks the build with debugfs enabled.

I've tried to built with CONFIG_DEBUG_FS={y/n} and it builds successfully. Did I miss something?
Maybe I need to enable/disable anything else CONFIG_*?

Thank you.

maintainer
#3 lore raw
Quoted 8 lines · Alexander Kuleshov

Hello Alex,

2015-07-14 11:11 GMT+06:00 Alex Deucher <[email protected]>:

Quoted 2 lines

This patch breaks the build with debugfs enabled.

I've tried to built with CONFIG_DEBUG_FS={y/n} and it builds successfully. Did I miss something?
Maybe I need to enable/disable anything else CONFIG_*?

Price question is why do you want to conditionally include this header in the first place?

If the kernel isn't build with CONFIG_DEBUG_FS we shouldn't use the defines, but otherwise they don't seem to hurt.

Regards,
Christian.

Quoted 2 lines

Thank you.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to Alexander Kuleshov
Quoted 4 lines · Alexander Kuleshov

Hello Alex,

2015-07-14 11:11 GMT+06:00 Alex Deucher <[email protected]>:

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

This patch breaks the build with debugfs enabled.

I've tried to built with CONFIG_DEBUG_FS={y/n} and it builds successfully. Did I miss something?
Maybe I need to enable/disable anything else CONFIG_*?

Thank you.

Here's the error:
CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_device.o
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c: In function ‘amdgpu_debugfs_regs_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1984:2: error: implicit declaration of function ‘debugfs_create_file’ [-Werror=implicit-function-declaration]
ent = debugfs_create_file("amdgpu_regs", S_IFREG | S_IRUGO, root, ^
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1984:6: warning: assignment makes pointer from integer without a cast [enabled by default]
ent = debugfs_create_file("amdgpu_regs", S_IFREG | S_IRUGO, root,

      ^

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c: In function ‘amdgpu_debugfs_regs_cleanup’:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1996:2: error: implicit declaration of function ‘debugfs_remove’ [-Werror=implicit-function-declaration]
debugfs_remove(adev->debugfs_regs);
^
cc1: some warnings being treated as errors
make[4]: *** [drivers/gpu/drm/amd/amdgpu/amdgpu_device.o] Error 1 make[3]: *** [drivers/gpu/drm/amd/amdgpu] Error 2 make[2]: *** [drivers/gpu/drm] Error 2
make[1]: *** [drivers/gpu] Error 2
make: *** [drivers] Error 2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel