Re: [PATCH] drm: Remove the unused param "struct drm_buddy *mm"
From: Maíra Canal
Date: Thu Aug 25 2022 - 07:52:01 EST
Hi Cai,
On 6/27/22 05:54, Cai Huoqing wrote:
> Remove the param "struct drm_buddy *mm" which is unused in
> the function drm_block_alloc()/drm_block_free().
>
> Signed-off-by: Cai Huoqing <cai.huoqing@xxxxxxxxx>
Reviewed-by: Maíra Canal <mairacanal@xxxxxxxxxx>
Best Regards,
- Maíra Canal
> ---
> drivers/gpu/drm/drm_buddy.c | 25 +++++++++++--------------
> 1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
> index 11bb59399471..192c8b99fb43 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -11,10 +11,8 @@
>
> static struct kmem_cache *slab_blocks;
>
> -static struct drm_buddy_block *drm_block_alloc(struct drm_buddy *mm,
> - struct drm_buddy_block *parent,
> - unsigned int order,
> - u64 offset)
> +static struct drm_buddy_block *
> +drm_block_alloc(struct drm_buddy_block *parent, unsigned int order, u64 offset)
> {
> struct drm_buddy_block *block;
>
> @@ -32,8 +30,7 @@ static struct drm_buddy_block *drm_block_alloc(struct drm_buddy *mm,
> return block;
> }
>
> -static void drm_block_free(struct drm_buddy *mm,
> - struct drm_buddy_block *block)
> +static void drm_block_free(struct drm_buddy_block *block)
> {
> kmem_cache_free(slab_blocks, block);
> }
> @@ -131,7 +128,7 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size)
> root_size = rounddown_pow_of_two(size);
> order = ilog2(root_size) - ilog2(chunk_size);
>
> - root = drm_block_alloc(mm, NULL, order, offset);
> + root = drm_block_alloc(NULL, order, offset);
> if (!root)
> goto out_free_roots;
>
> @@ -151,7 +148,7 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size)
>
> out_free_roots:
> while (i--)
> - drm_block_free(mm, mm->roots[i]);
> + drm_block_free(mm->roots[i]);
> kfree(mm->roots);
> out_free_list:
> kfree(mm->free_list);
> @@ -172,7 +169,7 @@ void drm_buddy_fini(struct drm_buddy *mm)
>
> for (i = 0; i < mm->n_roots; ++i) {
> WARN_ON(!drm_buddy_block_is_free(mm->roots[i]));
> - drm_block_free(mm, mm->roots[i]);
> + drm_block_free(mm->roots[i]);
> }
>
> WARN_ON(mm->avail != mm->size);
> @@ -191,14 +188,14 @@ static int split_block(struct drm_buddy *mm,
> BUG_ON(!drm_buddy_block_is_free(block));
> BUG_ON(!drm_buddy_block_order(block));
>
> - block->left = drm_block_alloc(mm, block, block_order, offset);
> + block->left = drm_block_alloc(block, block_order, offset);
> if (!block->left)
> return -ENOMEM;
>
> - block->right = drm_block_alloc(mm, block, block_order,
> + block->right = drm_block_alloc(block, block_order,
> offset + (mm->chunk_size << block_order));
> if (!block->right) {
> - drm_block_free(mm, block->left);
> + drm_block_free(block->left);
> return -ENOMEM;
> }
>
> @@ -257,8 +254,8 @@ static void __drm_buddy_free(struct drm_buddy *mm,
>
> list_del(&buddy->link);
>
> - drm_block_free(mm, block);
> - drm_block_free(mm, buddy);
> + drm_block_free(block);
> + drm_block_free(buddy);
>
> block = parent;
> }