public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Evan Quan" <evan.quan@amd.com>,
	"Hawking Zhang" <Hawking.Zhang@amd.com>,
	"Wenhui Sheng" <Wenhui.Sheng@amd.com>,
	"Guchun Chen" <Guchun.Chen@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>, kernel test robot <lkp@intel.com>,
	Tong Liu01 <Tong.Liu01@amd.com>, Yiqing Yao <yiqing.yao@amd.com>,
	ZhenGuo Yin <zhenguo.yin@amd.com>,
	Jonatas Esteves <jntesteves@gmail.com>,
	Kent Russell <kent.russell@amd.com>, Kun Liu <Kun.Liu2@amd.com>,
	Asad Kamal <asad.kamal@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] drm/amdgpu: fix building without DEBUG_FS
Date: Thu, 22 Jun 2023 12:20:26 +0200	[thread overview]
Message-ID: <20230622102035.3552643-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The debugfs file is defined unconditionally, but the registration is hidden
in an #ifdef, which causes a warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c:110:37: error: unused variable 'amdgpu_rap_debugfs_ops' [-Werror,-Wunused-const-variable]
static const struct file_operations amdgpu_rap_debugfs_ops = {
                                    ^

in amdgpu_pm.c, the same thing happens with the clocks[] variable:

drivers/gpu/drm/amd/pm/amdgpu_pm.c:38:34: error: unused variable 'clocks' [-Werror,-Wunused-const-variable]
static const struct cg_flag_name clocks[] = {
                                 ^

Since debugfs_create_file() does nothing when debugfs is disabled, removing
the ifdefs makes the code more readable and also avoids both warnings.

Fixes: a4322e1881bed ("drm/amdgpu: add debugfs interface for RAP test")
Fixes: e098bc9612c2b ("drm/amd/pm: optimize the power related source code layout")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202302200339.Whql7Emr-lkp@intel.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 2 --
 drivers/gpu/drm/amd/pm/amdgpu_pm.c      | 6 ------
 2 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c
index 12010c988c8b5..123bcf5c2bb13 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c
@@ -116,7 +116,6 @@ static const struct file_operations amdgpu_rap_debugfs_ops = {
 
 void amdgpu_rap_debugfs_init(struct amdgpu_device *adev)
 {
-#if defined(CONFIG_DEBUG_FS)
 	struct drm_minor *minor = adev_to_drm(adev)->primary;
 
 	if (!adev->psp.rap_context.context.initialized)
@@ -124,5 +123,4 @@ void amdgpu_rap_debugfs_init(struct amdgpu_device *adev)
 
 	debugfs_create_file("rap_test", S_IWUSR, minor->debugfs_root,
 				adev, &amdgpu_rap_debugfs_ops);
-#endif
 }
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index a57952b93e73f..ec39805b762e6 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -3565,8 +3565,6 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
 /*
  * Debugfs info
  */
-#if defined(CONFIG_DEBUG_FS)
-
 static void amdgpu_debugfs_prints_cpu_info(struct seq_file *m,
 					   struct amdgpu_device *adev) {
 	uint16_t *p_val;
@@ -3768,11 +3766,8 @@ static const struct file_operations amdgpu_debugfs_pm_prv_buffer_fops = {
 	.llseek = default_llseek,
 };
 
-#endif
-
 void amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
 {
-#if defined(CONFIG_DEBUG_FS)
 	struct drm_minor *minor = adev_to_drm(adev)->primary;
 	struct dentry *root = minor->debugfs_root;
 
@@ -3789,5 +3784,4 @@ void amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
 					 adev->pm.smu_prv_buffer_size);
 
 	amdgpu_dpm_stb_debug_fs_init(adev);
-#endif
 }
-- 
2.39.2


                 reply	other threads:[~2023-06-22 10:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230622102035.3552643-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=Guchun.Chen@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Kun.Liu2@amd.com \
    --cc=Tong.Liu01@amd.com \
    --cc=Wenhui.Sheng@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arnd@arndb.de \
    --cc=asad.kamal@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=jntesteves@gmail.com \
    --cc=kent.russell@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=yiqing.yao@amd.com \
    --cc=zhenguo.yin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox