<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Candice Li <candice.li@amd.com><br>
<b>Sent:</b> Wednesday, April 27, 2022 7:22 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Li, Candice <Candice.Li@amd.com><br>
<b>Subject:</b> [PATCH v2] drm/amdgpu: Fix build warning for TA debugfs interface</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt" class="elementToProof">
<div class="PlainText elementToProof">Remove the redundant codes to fix build warning<br>
when CONFIG_DEBUG_FS is disabled.<br>
<br>
Reported-by: Randy Dunlap <rdunlap@infradead.org><br>
Signed-off-by: Candice Li <candice.li@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 43 ++++++----------------<br>
 1 file changed, 12 insertions(+), 31 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c<br>
index 6806deb098d3f7..97ea2246bc1ddb 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c<br>
@@ -24,13 +24,6 @@<br>
 #include "amdgpu.h"<br>
 #include "amdgpu_psp_ta.h"<br>
 <br>
-static const char *TA_IF_FS_NAME = "ta_if";<br>
-<br>
-struct dentry *dir;<br>
-static struct dentry *ta_load_debugfs_dentry;<br>
-static struct dentry *ta_unload_debugfs_dentry;<br>
-static struct dentry *ta_invoke_debugfs_dentry;<br>
-<br>
 static ssize_t ta_if_load_debugfs_write(struct file *fp, const char *buf,<br>
                                             size_t len, loff_t *off);<br>
 static ssize_t ta_if_unload_debugfs_write(struct file *fp, const char *buf,<br>
@@ -38,7 +31,6 @@ static ssize_t ta_if_unload_debugfs_write(struct file *fp, const char *buf,<br>
 static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf,<br>
                                             size_t len, loff_t *off);<br>
 <br>
-<br>
 static uint32_t get_bin_version(const uint8_t *bin)<br>
 {<br>
         const struct common_firmware_header *hdr =<br>
@@ -74,19 +66,19 @@ static bool is_ta_type_valid(enum ta_type_id ta_type)<br>
 }<br>
 <br>
 static const struct file_operations ta_load_debugfs_fops = {<br>
-       .write   = ta_if_load_debugfs_write,<br>
+       .write  = ta_if_load_debugfs_write,<br>
         .llseek = default_llseek,<br>
         .owner  = THIS_MODULE<br>
 };<br>
 <br>
 static const struct file_operations ta_unload_debugfs_fops = {<br>
-       .write   = ta_if_unload_debugfs_write,<br>
+       .write  = ta_if_unload_debugfs_write,<br>
         .llseek = default_llseek,<br>
         .owner  = THIS_MODULE<br>
 };<br>
 <br>
 static const struct file_operations ta_invoke_debugfs_fops = {<br>
-       .write   = ta_if_invoke_debugfs_write,<br>
+       .write  = ta_if_invoke_debugfs_write,<br>
         .llseek = default_llseek,<br>
         .owner  = THIS_MODULE<br>
 };<br>
@@ -286,31 +278,20 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size<br>
         return ret;<br>
 }<br>
 <br>
-static struct dentry *amdgpu_ta_if_debugfs_create(struct amdgpu_device *adev)<br>
+void amdgpu_ta_if_debugfs_init(struct amdgpu_device *adev)<br>
 {<br>
+#if defined(CONFIG_DEBUG_FS)</div>
<div class="PlainText elementToProof"><br>
</div>
<div class="PlainText elementToProof"> <br>
         struct drm_minor *minor = adev_to_drm(adev)->primary;<br>
 <br>
-       dir = debugfs_create_dir(TA_IF_FS_NAME, minor->debugfs_root);<br>
-<br>
-       ta_load_debugfs_dentry = debugfs_create_file("ta_load", 0200, dir, adev,<br>
-                                                    &ta_load_debugfs_fops);<br>
+       struct dentry *dir = debugfs_create_dir("ta_if", minor->debugfs_root);<br>
 <br>
-       ta_unload_debugfs_dentry = debugfs_create_file("ta_unload", 0200, dir,<br>
-                                                    adev, &ta_unload_debugfs_fops);<br>
+       debugfs_create_file("ta_load", 0200, dir, adev,<br>
+                                    &ta_load_debugfs_fops);<br>
 <br>
-       ta_invoke_debugfs_dentry = debugfs_create_file("ta_invoke", 0200, dir,<br>
-                                                    adev, &ta_invoke_debugfs_fops);<br>
-       return dir;<br>
-}<br>
+       debugfs_create_file("ta_unload", 0200, dir,<br>
+                                    adev, &ta_unload_debugfs_fops);</div>
<div class="PlainText elementToProof"><br>
</div>
<div class="PlainText elementToProof"><span class="PlainText" style="margin: 0px; background-color: rgb(255, 255, 255); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">[kevin]:</span>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><br>
</div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">I
 think your patch is still have "defined but not used" warning,</span></div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">because
 the ta_xxx_debugfs_fops are not used when the macro of CONFIG_DEBUG_FS is undefined.</span></div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><br>
</div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"></div>
</div>
<div class="PlainText elementToProof"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">It's
 better to add this macro check outside all functions.</span></div>
<div class="PlainText elementToProof">
<div><br>
</div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Best
 Regards,</span></div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Kevin</span></div>
<div class="PlainText" style="margin:0px;background-color:rgb(255, 255, 255)"><br>
</div>
-void amdgpu_ta_if_debugfs_init(struct amdgpu_device *adev)<br>
-{<br>
-#if defined(CONFIG_DEBUG_FS)<br>
-       dir = amdgpu_ta_if_debugfs_create(adev);<br>
+       debugfs_create_file("ta_invoke", 0200, dir,<br>
+                                    adev, &ta_invoke_debugfs_fops);<br>
 #endif<br>
 }<br>
-<br>
-void amdgpu_ta_if_debugfs_remove(void)<br>
-{<br>
-       debugfs_remove_recursive(dir);<br>
-}<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>