]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amdgpu: use ARRAY_SIZE() to add amdgpu debugfs files
authorXiaojie Yuan <xiaojie.yuan@amd.com>
Mon, 13 Jul 2020 05:55:42 +0000 (13:55 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 14 Jul 2020 18:38:41 +0000 (14:38 -0400)
to easily add new debugfs file w/o changing the hardcoded list count.

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c

index b8ce43c281162fd1a0246b8fc1a812cf8fd35e99..58d4c219178a29593592197beed39abfa8bfef48 100644 (file)
@@ -781,8 +781,10 @@ int amdgpu_debugfs_fence_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
        if (amdgpu_sriov_vf(adev))
-               return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_fence_list_sriov, 1);
-       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_fence_list, 2);
+               return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_fence_list_sriov,
+                                               ARRAY_SIZE(amdgpu_debugfs_fence_list_sriov));
+       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_fence_list,
+                                       ARRAY_SIZE(amdgpu_debugfs_fence_list));
 #else
        return 0;
 #endif
index de9784b0c19b1c5377d2e933430f9240122c7000..7f9e50247413d97ad5c6dcc21037576b20959f1f 100644 (file)
@@ -930,7 +930,8 @@ static const struct drm_info_list amdgpu_debugfs_gem_list[] = {
 int amdgpu_debugfs_gem_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
-       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_gem_list, 1);
+       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_gem_list,
+                                       ARRAY_SIZE(amdgpu_debugfs_gem_list));
 #endif
        return 0;
 }
index 4ffc32b7874557d918926ceaf6a16f1e9ec75f4a..dcd4921705987c44b798bfa92c0f037b968a4dd4 100644 (file)
@@ -468,7 +468,8 @@ static const struct drm_info_list amdgpu_debugfs_sa_list[] = {
 int amdgpu_debugfs_sa_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
-       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_sa_list, 1);
+       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_sa_list,
+                                       ARRAY_SIZE(amdgpu_debugfs_sa_list));
 #else
        return 0;
 #endif