Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.

Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: YueHaibing <yuehaib...@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 20ce158490db..9d9f4cbbc4bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1082,15 +1082,15 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 
val)
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
-                       amdgpu_debugfs_ib_preempt, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL, amdgpu_debugfs_ib_preempt,
+                        "%llu\n");
 
 int amdgpu_debugfs_init(struct amdgpu_device *adev)
 {
        adev->debugfs_preempt =
-               debugfs_create_file("amdgpu_preempt_ib", 0600,
-                                   adev->ddev->primary->debugfs_root,
-                                   (void *)adev, &fops_ib_preempt);
+               debugfs_create_file_unsafe("amdgpu_preempt_ib", 0600,
+                                          adev->ddev->primary->debugfs_root,
+                                          (void *)adev, &fops_ib_preempt);
        if (!(adev->debugfs_preempt)) {
                DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
                return -EIO;





_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to