public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller
@ 2024-02-21  8:59 Kunwu Chan
  2024-02-27  5:12 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 3+ messages in thread
From: Kunwu Chan @ 2024-02-21  8:59 UTC (permalink / raw)
  To: manivannan.sadhasivam; +Cc: mhi, linux-arm-msm, 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/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


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

* Re: [PATCH] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller
  2024-02-21  8:59 [PATCH] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller Kunwu Chan
@ 2024-02-27  5:12 ` Manivannan Sadhasivam
  2024-02-27  9:55   ` Kunwu Chan
  0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2024-02-27  5:12 UTC (permalink / raw)
  To: Kunwu Chan; +Cc: mhi, linux-arm-msm, linux-kernel

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
> 
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller
  2024-02-27  5:12 ` Manivannan Sadhasivam
@ 2024-02-27  9:55   ` Kunwu Chan
  0 siblings, 0 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-02-27  9:55 UTC (permalink / raw)
  To: manivannan.sadhasivam; +Cc: chentao, linux-arm-msm, linux-kernel, mhi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=8bit, Size: 1345 bytes --]

Thanks for the reply.
> > 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?

Sure, I'll change all of them if possible in v2 patch.

> 
> - 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
> > 
> > 
> 
> -- 
> மணிவண்ணன் சதாசிவம்
> 
 Thanks,
	Kunwu.Chan

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

end of thread, other threads:[~2024-02-27  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21  8:59 [PATCH] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller Kunwu Chan
2024-02-27  5:12 ` Manivannan Sadhasivam
2024-02-27  9:55   ` Kunwu Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox