diff mbox series

bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller

Message ID 20240221085937.167200-1-chentao@kylinos.cn
State New
Headers show
Series bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller | expand

Commit Message

Kunwu Chan Feb. 21, 2024, 8:59 a.m. UTC
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/bus/mhi/ep/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Manivannan Sadhasivam Feb. 27, 2024, 5:12 a.m. UTC | #1
On Wed, Feb 21, 2024 at 04:59:37PM +0800, Kunwu Chan wrote:
> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> to simplify the creation of SLAB caches.
> 

There are multiple instances of kmem_cache_create() in this driver. Could you
change them also?

- Mani

> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
>  drivers/bus/mhi/ep/main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
> index 65fc1d738bec..7b61d384b2b6 100644
> --- a/drivers/bus/mhi/ep/main.c
> +++ b/drivers/bus/mhi/ep/main.c
> @@ -1493,9 +1493,7 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
>  		goto err_destroy_ev_ring_el_cache;
>  	}
>  
> -	mhi_cntrl->ring_item_cache = kmem_cache_create("mhi_ep_ring_item",
> -							sizeof(struct mhi_ep_ring_item), 0,
> -							0, NULL);
> +	mhi_cntrl->ring_item_cache = KMEM_CACHE(mhi_ep_ring_item, 0);
>  	if (!mhi_cntrl->ev_ring_el_cache) {
>  		ret = -ENOMEM;
>  		goto err_destroy_tre_buf_cache;
> -- 
> 2.39.2
> 
>
diff mbox series

Patch

diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index 65fc1d738bec..7b61d384b2b6 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -1493,9 +1493,7 @@  int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
 		goto err_destroy_ev_ring_el_cache;
 	}
 
-	mhi_cntrl->ring_item_cache = kmem_cache_create("mhi_ep_ring_item",
-							sizeof(struct mhi_ep_ring_item), 0,
-							0, NULL);
+	mhi_cntrl->ring_item_cache = KMEM_CACHE(mhi_ep_ring_item, 0);
 	if (!mhi_cntrl->ev_ring_el_cache) {
 		ret = -ENOMEM;
 		goto err_destroy_tre_buf_cache;