drm/amd/amdgpu: Fix warnings in amdgpu _object, _ring.c
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Tue, 9 May 2023 13:38:17 +0000 (19:08 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 13:38:20 +0000 (09:38 -0400)
Fix below warnings reported by checkpatch:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: static const char * array should probably be static const char * const
WARNING: space prohibited between function name and open parenthesis '('
WARNING: braces {} are not necessary for single statement blocks
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

index 2bd1a54..9f0d5f0 100644 (file)
@@ -130,7 +130,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
        u32 c = 0;
 
        if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
-               unsigned visible_pfn = adev->gmc.visible_vram_size >> PAGE_SHIFT;
+               unsigned int visible_pfn = adev->gmc.visible_vram_size >> PAGE_SHIFT;
 
                places[c].fpfn = 0;
                places[c].lpfn = 0;
@@ -935,7 +935,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
        amdgpu_bo_placement_from_domain(bo, domain);
        for (i = 0; i < bo->placement.num_placement; i++) {
-               unsigned fpfn, lpfn;
+               unsigned int fpfn, lpfn;
 
                fpfn = min_offset >> PAGE_SHIFT;
                lpfn = max_offset >> PAGE_SHIFT;
@@ -1016,7 +1016,7 @@ void amdgpu_bo_unpin(struct amdgpu_bo *bo)
        }
 }
 
-static const char *amdgpu_vram_names[] = {
+static const char * const amdgpu_vram_names[] = {
        "UNKNOWN",
        "GDDR1",
        "DDR2",
@@ -1148,8 +1148,8 @@ void amdgpu_bo_get_tiling_flags(struct amdgpu_bo *bo, u64 *tiling_flags)
  * Returns:
  * 0 for success or a negative error code on failure.
  */
-int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
-                           uint32_t metadata_size, uint64_t flags)
+int amdgpu_bo_set_metadata(struct amdgpu_bo *bo, void *metadata,
+                          u32 metadata_size, uint64_t flags)
 {
        struct amdgpu_bo_user *ubo;
        void *buffer;
index 1e9ae3b..d8a78de 100644 (file)
@@ -78,7 +78,7 @@ unsigned int amdgpu_ring_max_ibs(enum amdgpu_ring_type type)
  * Allocate @ndw dwords in the ring buffer (all asics).
  * Returns 0 on success, error on failure.
  */
-int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw)
+int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned int ndw)
 {
        /* Align requested size with padding so unlock_commit can
         * pad safely */
@@ -315,9 +315,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
                     amdgpu_ring_max_ibs(ring->funcs->type) * ring->funcs->emit_ib_size;
        max_ibs_dw = (max_ibs_dw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
-       if (WARN_ON(max_ibs_dw > max_dw)) {
+       if (WARN_ON(max_ibs_dw > max_dw))
                max_dw = max_ibs_dw;
-       }
 
        ring->ring_size = roundup_pow_of_two(max_dw * 4 * sched_hw_submission);
 
@@ -573,13 +572,13 @@ void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
        char name[32];
 
        sprintf(name, "amdgpu_ring_%s", ring->name);
-       debugfs_create_file_size(name, S_IFREG | S_IRUGO, root, ring,
+       debugfs_create_file_size(name, S_IFREG | 0444, root, ring,
                                 &amdgpu_debugfs_ring_fops,
                                 ring->ring_size + 12);
 
        if (ring->mqd_obj) {
                sprintf(name, "amdgpu_mqd_%s", ring->name);
-               debugfs_create_file_size(name, S_IFREG | S_IRUGO, root, ring,
+               debugfs_create_file_size(name, S_IFREG | 0444, root, ring,
                                         &amdgpu_debugfs_mqd_fops,
                                         ring->mqd_size);
        }