diff mbox

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

Message ID 1436785437-3457-1-git-send-email-kuleshovmail@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Kuleshov July 13, 2015, 11:03 a.m. UTC
We have no need to include <linux/debugfs.h> if the CONFIG_DEBUG_FS option
is not set.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


+#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

Comments

Alex Deucher July 14, 2015, 5:11 a.m. UTC | #1
On Mon, Jul 13, 2015 at 7:03 AM, Alexander Kuleshov
<kuleshovmail@gmail.com> wrote:
> 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

> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index ba46be3..23dbfa4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -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
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Alexander Kuleshov July 14, 2015, 8:18 a.m. UTC | #2
Hello Alex,

2015-07-14 11:11 GMT+06:00 Alex Deucher <alexdeucher@gmail.com>:
>
> 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.
Christian König July 14, 2015, 8:23 a.m. UTC | #3
On 14.07.2015 10:18, Alexander Kuleshov wrote:
> Hello Alex,
>
> 2015-07-14 11:11 GMT+06:00 Alex Deucher <alexdeucher@gmail.com>:
>> 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.

>
> Thank you.
Alex Deucher July 14, 2015, 2:29 p.m. UTC | #4
On Tue, Jul 14, 2015 at 4:18 AM, Alexander Kuleshov
<kuleshovmail@gmail.com> wrote:
> Hello Alex,
>
> 2015-07-14 11:11 GMT+06:00 Alex Deucher <alexdeucher@gmail.com>:
>>
>> 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
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index ba46be3..23dbfa4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -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"