dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/scheduler: Simplify the allocation of slab caches in drm_sched_fence_slab_init
@ 2024-02-21  8:55 Kunwu Chan
  2024-02-28 14:56 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Kunwu Chan @ 2024-02-21  8:55 UTC (permalink / raw)
  To: ltuikov89, maarten.lankhorst, mripard, tzimmermann, airlied, daniel
  Cc: dri-devel, linux-kernel, Kunwu Chan

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 drivers/gpu/drm/scheduler/sched_fence.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_fence.c b/drivers/gpu/drm/scheduler/sched_fence.c
index 06cedfe4b486..0f35f009b9d3 100644
--- a/drivers/gpu/drm/scheduler/sched_fence.c
+++ b/drivers/gpu/drm/scheduler/sched_fence.c
@@ -33,9 +33,7 @@ static struct kmem_cache *sched_fence_slab;
 
 static int __init drm_sched_fence_slab_init(void)
 {
-	sched_fence_slab = kmem_cache_create(
-		"drm_sched_fence", sizeof(struct drm_sched_fence), 0,
-		SLAB_HWCACHE_ALIGN, NULL);
+	sched_fence_slab = KMEM_CACHE(drm_sched_fence, SLAB_HWCACHE_ALIGN);
 	if (!sched_fence_slab)
 		return -ENOMEM;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/scheduler: Simplify the allocation of slab caches in drm_sched_fence_slab_init
  2024-02-21  8:55 [PATCH] drm/scheduler: Simplify the allocation of slab caches in drm_sched_fence_slab_init Kunwu Chan
@ 2024-02-28 14:56 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2024-02-28 14:56 UTC (permalink / raw)
  To: Kunwu Chan
  Cc: ltuikov89, maarten.lankhorst, mripard, tzimmermann, airlied,
	daniel, dri-devel, linux-kernel

On Wed, Feb 21, 2024 at 04:55:58PM +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
> 
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>

Applied to drm-misc-next, thanks for your patch!
-Sima

> ---
>  drivers/gpu/drm/scheduler/sched_fence.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_fence.c b/drivers/gpu/drm/scheduler/sched_fence.c
> index 06cedfe4b486..0f35f009b9d3 100644
> --- a/drivers/gpu/drm/scheduler/sched_fence.c
> +++ b/drivers/gpu/drm/scheduler/sched_fence.c
> @@ -33,9 +33,7 @@ static struct kmem_cache *sched_fence_slab;
>  
>  static int __init drm_sched_fence_slab_init(void)
>  {
> -	sched_fence_slab = kmem_cache_create(
> -		"drm_sched_fence", sizeof(struct drm_sched_fence), 0,
> -		SLAB_HWCACHE_ALIGN, NULL);
> +	sched_fence_slab = KMEM_CACHE(drm_sched_fence, SLAB_HWCACHE_ALIGN);
>  	if (!sched_fence_slab)
>  		return -ENOMEM;
>  
> -- 
> 2.39.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-28 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21  8:55 [PATCH] drm/scheduler: Simplify the allocation of slab caches in drm_sched_fence_slab_init Kunwu Chan
2024-02-28 14:56 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).