All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Yang Wang <KevinYang.Wang@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: felix.kuehling@amd.com, lijo.lazar@amd.com
Subject: Re: [PATCH] drm/ttm: use kvcalloc() instead of kvmalloc_array() in ttm_tt
Date: Thu, 21 Apr 2022 14:48:33 +0200	[thread overview]
Message-ID: <60be4755-47ac-cb5e-1486-d9b42cf43b49@amd.com> (raw)
In-Reply-To: <20220421123442.1834102-1-KevinYang.Wang@amd.com>

Am 21.04.22 um 14:34 schrieb Yang Wang:
> simplify programming with existing functions.
>
> Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>

With a minimal style change reviewed and pushed to drm-misc-next.

Thanks,
Christian.

> ---
>   drivers/gpu/drm/ttm/ttm_tt.c | 21 ++++++++++++---------
>   1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index 79c870a3bef8..cbb3d1fb4caf 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -96,19 +96,20 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
>    */
>   static int ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
>   {
> -	ttm->pages = kvmalloc_array(ttm->num_pages, sizeof(void*),
> -			GFP_KERNEL | __GFP_ZERO);
> +	ttm->pages = kvcalloc(ttm->num_pages, sizeof(void*),
> +			      GFP_KERNEL);
>   	if (!ttm->pages)
>   		return -ENOMEM;
> +
>   	return 0;
>   }
>   
>   static int ttm_dma_tt_alloc_page_directory(struct ttm_tt *ttm)
>   {
> -	ttm->pages = kvmalloc_array(ttm->num_pages,
> -				    sizeof(*ttm->pages) +
> -				    sizeof(*ttm->dma_address),
> -				    GFP_KERNEL | __GFP_ZERO);
> +	ttm->pages = kvcalloc(ttm->num_pages,
> +			      sizeof(*ttm->pages) +
> +			      sizeof(*ttm->dma_address),
> +			      GFP_KERNEL);
>   	if (!ttm->pages)
>   		return -ENOMEM;
>   
> @@ -118,11 +119,13 @@ static int ttm_dma_tt_alloc_page_directory(struct ttm_tt *ttm)
>   
>   static int ttm_sg_tt_alloc_page_directory(struct ttm_tt *ttm)
>   {
> -	ttm->dma_address = kvmalloc_array(ttm->num_pages,
> -					  sizeof(*ttm->dma_address),
> -					  GFP_KERNEL | __GFP_ZERO);
> +	ttm->dma_address = kvcalloc(ttm->num_pages,
> +				    sizeof(*ttm->dma_address),
> +				    GFP_KERNEL);
>   	if (!ttm->dma_address)
>   		return -ENOMEM;
> +
> +
>   	return 0;
>   }
>   


  reply	other threads:[~2022-04-21 12:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 12:34 [PATCH] drm/ttm: use kvcalloc() instead of kvmalloc_array() in ttm_tt Yang Wang
2022-04-21 12:48 ` Christian König [this message]
2022-04-21 13:03   ` Wang, Yang(Kevin)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60be4755-47ac-cb5e-1486-d9b42cf43b49@amd.com \
    --to=christian.koenig@amd.com \
    --cc=KevinYang.Wang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=lijo.lazar@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.