2015-07-13 11:04:08

by Alexander Kuleshov

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Alexander Kuleshov <[email protected]>
---
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


2015-07-14 05:12:01

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/amdgpu: Include <linux/debugfs.h> only if CONFIG_DEBUG_FS is set

On Mon, Jul 13, 2015 at 7:03 AM, Alexander Kuleshov
<[email protected]> 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 <[email protected]>
> ---
> 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
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

2015-07-14 08:18:44

by Alexander Kuleshov

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/amdgpu: Include <linux/debugfs.h> only if CONFIG_DEBUG_FS is set

Hello Alex,

2015-07-14 11:11 GMT+06:00 Alex Deucher <[email protected]>:
>
> 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.

2015-07-14 08:23:44

by Christian König

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/amdgpu: Include <linux/debugfs.h> only if CONFIG_DEBUG_FS is set

On 14.07.2015 10:18, Alexander Kuleshov wrote:
> Hello Alex,
>
> 2015-07-14 11:11 GMT+06:00 Alex Deucher <[email protected]>:
>> 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.

2015-07-14 14:29:22

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/amdgpu: Include <linux/debugfs.h> only if CONFIG_DEBUG_FS is set

On Tue, Jul 14, 2015 at 4:18 AM, Alexander Kuleshov
<[email protected]> wrote:
> Hello Alex,
>
> 2015-07-14 11:11 GMT+06:00 Alex Deucher <[email protected]>:
>>
>> 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