drm/amdgpu: Fix build warning for TA debugfs interface
Subsystems (2)
PATCH v3 1/1 drm/amdgpu: Fix build warning for TA debugfs interface
Remove the redundant codes to fix build warning
when CONFIG_DEBUG_FS is disabled.
Reported-by Randy Dunlap <[email protected]>
Signed-off-by Candice Li <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 40 ++++++++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.h | 1 - 2 files changed, 14 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c +14 -26
@@ -24,12 +24,7 @@#include "amdgpu.h" #include "amdgpu_psp_ta.h" -static const char *TA_IF_FS_NAME ="ta_if" ; - -struct dentry *dir; -static struct dentry *ta_load_debugfs_dentry; -static struct dentry *ta_unload_debugfs_dentry; -static struct dentry *ta_invoke_debugfs_dentry; +#if defined(CONFIG_DEBUG_FS )static ssize_t ta_if_load_debugfs_write (struct file *fp,const char *buf,size_t len,loff_t *off);
@@ -38,7 +33,6 @@ static ssize_t ta_if_unload_debugfs_write(struct file *fp, const char *buf,static ssize_t ta_if_invoke_debugfs_write (struct file *fp,const char *buf,size_t len,loff_t *off); -static uint32_t get_bin_version (const uint8_t *bin) { const struct common_firmware_header *hdr =
@@ -74,19 +68,19 @@ static bool is_ta_type_valid(enum ta_type_id ta_type) }static const struct file_operations ta_load_debugfs_fops = { - .write = ta_if_load_debugfs_write, + .write = ta_if_load_debugfs_write, .llseek = default_llseek, .owner =THIS_MODULE };static const struct file_operations ta_unload_debugfs_fops = { - .write = ta_if_unload_debugfs_write, + .write = ta_if_unload_debugfs_write, .llseek = default_llseek, .owner =THIS_MODULE };static const struct file_operations ta_invoke_debugfs_fops = { - .write = ta_if_invoke_debugfs_write, + .write = ta_if_invoke_debugfs_write, .llseek = default_llseek, .owner =THIS_MODULE };
@@ -286,31 +280,25 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size return ret; } -static struct dentry *amdgpu_ta_if_debugfs_create (struct amdgpu_device *adev) +void amdgpu_ta_if_debugfs_init (struct amdgpu_device *adev) {struct drm_minor *minor =adev_to_drm (adev)->primary; - dir =debugfs_create_dir (TA_IF_FS_NAME , minor->debugfs_root); +struct dentry *dir =debugfs_create_dir ("ta_if" , minor->debugfs_root); - ta_load_debugfs_dentry =debugfs_create_file ("ta_load" ,0200 , dir, adev, - &ta_load_debugfs_fops); +debugfs_create_file ("ta_load" ,0200 , dir, adev, + &ta_load_debugfs_fops); - ta_unload_debugfs_dentry =debugfs_create_file ("ta_unload" ,0200 , dir, - adev, &ta_unload_debugfs_fops); +debugfs_create_file ("ta_unload" ,0200 , dir, + adev, &ta_unload_debugfs_fops); - ta_invoke_debugfs_dentry =debugfs_create_file ("ta_invoke" ,0200 , dir, - adev, &ta_invoke_debugfs_fops); -return dir; +debugfs_create_file ("ta_invoke" ,0200 , dir, + adev, &ta_invoke_debugfs_fops); } +#else void amdgpu_ta_if_debugfs_init (struct amdgpu_device *adev) { -#if defined(CONFIG_DEBUG_FS ) - dir =amdgpu_ta_if_debugfs_create (adev); -#endif -} -void amdgpu_ta_if_debugfs_remove (void ) -{ -debugfs_remove_recursive (dir); } +#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.h +0 -1
@@ -25,6 +25,5 @@#define __AMDGPU_PSP_TA_H__void amdgpu_ta_if_debugfs_init (struct amdgpu_device *adev); -void amdgpu_ta_if_debugfs_remove (void );#endif
Signature · 1 line
2.17.1
[AMD Official Use Only - General]
Reviewed-by Yang Wang <[email protected]>
Best Regards,
Kevin
________________________________
From: amd-gfx <[email protected]> on behalf of Candice Li <[email protected]>
Sent: Thursday, April 28, 2022 4:25 PM
To: [email protected] <[email protected]>
Cc: Li, Candice <[email protected]>
Subject: [PATCH v3] drm/amdgpu: Fix build warning for TA debugfs interface
Remove the redundant codes to fix build warning
when CONFIG_DEBUG_FS is disabled.
Reported-by Randy Dunlap <[email protected]>
Signed-off-by Candice Li <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 40 ++++++++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.h | 1 - 2 files changed, 14 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c +14 -26
@@ -24,12 +24,7 @@#include "amdgpu.h" #include "amdgpu_psp_ta.h" -static const char *TA_IF_FS_NAME ="ta_if" ; - -struct dentry *dir; -static struct dentry *ta_load_debugfs_dentry; -static struct dentry *ta_unload_debugfs_dentry; -static struct dentry *ta_invoke_debugfs_dentry; +#if defined(CONFIG_DEBUG_FS )static ssize_t ta_if_load_debugfs_write (struct file *fp,const char *buf,size_t len,loff_t *off);
@@ -38,7 +33,6 @@ static ssize_t ta_if_unload_debugfs_write(struct file *fp, const char *buf,static ssize_t ta_if_invoke_debugfs_write (struct file *fp,const char *buf,size_t len,loff_t *off); -static uint32_t get_bin_version (const uint8_t *bin) { const struct common_firmware_header *hdr =
@@ -74,19 +68,19 @@ static bool is_ta_type_valid(enum ta_type_id ta_type) }static const struct file_operations ta_load_debugfs_fops = { - .write = ta_if_load_debugfs_write, + .write = ta_if_load_debugfs_write, .llseek = default_llseek, .owner =THIS_MODULE };static const struct file_operations ta_unload_debugfs_fops = { - .write = ta_if_unload_debugfs_write, + .write = ta_if_unload_debugfs_write, .llseek = default_llseek, .owner =THIS_MODULE };static const struct file_operations ta_invoke_debugfs_fops = { - .write = ta_if_invoke_debugfs_write, + .write = ta_if_invoke_debugfs_write, .llseek = default_llseek, .owner =THIS_MODULE };
@@ -286,31 +280,25 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size return ret; } -static struct dentry *amdgpu_ta_if_debugfs_create (struct amdgpu_device *adev) +void amdgpu_ta_if_debugfs_init (struct amdgpu_device *adev) {struct drm_minor *minor =adev_to_drm (adev)->primary; - dir =debugfs_create_dir (TA_IF_FS_NAME , minor->debugfs_root); +struct dentry *dir =debugfs_create_dir ("ta_if" , minor->debugfs_root); - ta_load_debugfs_dentry =debugfs_create_file ("ta_load" ,0200 , dir, adev, - &ta_load_debugfs_fops); +debugfs_create_file ("ta_load" ,0200 , dir, adev, + &ta_load_debugfs_fops); - ta_unload_debugfs_dentry =debugfs_create_file ("ta_unload" ,0200 , dir, - adev, &ta_unload_debugfs_fops); +debugfs_create_file ("ta_unload" ,0200 , dir, + adev, &ta_unload_debugfs_fops); - ta_invoke_debugfs_dentry =debugfs_create_file ("ta_invoke" ,0200 , dir, - adev, &ta_invoke_debugfs_fops); -return dir; +debugfs_create_file ("ta_invoke" ,0200 , dir, + adev, &ta_invoke_debugfs_fops); } +#else void amdgpu_ta_if_debugfs_init (struct amdgpu_device *adev) { -#if defined(CONFIG_DEBUG_FS ) - dir =amdgpu_ta_if_debugfs_create (adev); -#endif -} -void amdgpu_ta_if_debugfs_remove (void ) -{ -debugfs_remove_recursive (dir); } +#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.h +0 -1
@@ -25,6 +25,5 @@#define __AMDGPU_PSP_TA_H__void amdgpu_ta_if_debugfs_init (struct amdgpu_device *adev); -void amdgpu_ta_if_debugfs_remove (void );#endif
--
2.17.1