Re: [PATCH] drm/amd/amdgpu: Fix warnings in amdgpu _object, _ring.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 9, 2023 at 10:03 AM Srinivasan Shanmugam
<srinivasan.shanmugam@xxxxxxx> wrote:
>
> 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@xxxxxxx>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>

Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +++++-----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c   |  9 ++++-----
>  2 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 7c9b788ae0a9..fbd906ac556e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -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;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index a1d480b7fd1f..7429b20257a6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -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);
>
> @@ -591,7 +590,7 @@ 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);
>
> @@ -601,7 +600,7 @@ void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>
>         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);
>         }
> --
> 2.25.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux