From: Kunwu Chan <chentao@kylinos.cn>
To: manivannan.sadhasivam@linaro.org
Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn>
Subject: [PATCH v2] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller
Date: Wed, 28 Feb 2024 11:00:56 +0800 [thread overview]
Message-ID: <20240228030056.509994-1-chentao@kylinos.cn> (raw)
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>
---
v2:
- Simplify the allocations of mhi_ring_element slab caches
---
drivers/bus/mhi/ep/main.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index 65fc1d738bec..795611482f16 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -1478,9 +1478,7 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
goto err_free_ch;
}
- mhi_cntrl->ev_ring_el_cache = kmem_cache_create("mhi_ep_event_ring_el",
- sizeof(struct mhi_ring_element), 0,
- SLAB_CACHE_DMA, NULL);
+ mhi_cntrl->ev_ring_el_cache = KMEM_CACHE(mhi_ring_element, SLAB_CACHE_DMA);
if (!mhi_cntrl->ev_ring_el_cache) {
ret = -ENOMEM;
goto err_free_cmd;
@@ -1493,9 +1491,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
next reply other threads:[~2024-02-28 3:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 3:00 Kunwu Chan [this message]
2024-03-19 16:35 ` [PATCH v2] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller Manivannan Sadhasivam
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=20240228030056.509994-1-chentao@kylinos.cn \
--to=chentao@kylinos.cn \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mhi@lists.linux.dev \
/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 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 read-only IMAP folder(s) and NNTP newsgroup(s).