[PATCH] iommu/iova: Simplify IOVA cache allocation with KMEM_CACHE()
From: Cong Liu
Date: Tue Feb 27 2024 - 04:08:35 EST
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Cong Liu <liucong2@xxxxxxxxxx>
---
drivers/iommu/iova.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index d59d0ea2fd21..9134acae76f5 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -950,14 +950,11 @@ int iova_cache_get(void)
mutex_lock(&iova_cache_mutex);
if (!iova_cache_users) {
- iova_cache = kmem_cache_create("iommu_iova", sizeof(struct iova), 0,
- SLAB_HWCACHE_ALIGN, NULL);
+ iova_cache = KMEM_CACHE(iova, SLAB_HWCACHE_ALIGN);
if (!iova_cache)
goto out_err;
- iova_magazine_cache = kmem_cache_create("iommu_iova_magazine",
- sizeof(struct iova_magazine),
- 0, SLAB_HWCACHE_ALIGN, NULL);
+ iova_magazine_cache = KMEM_CACHE(iova_magazine, SLAB_HWCACHE_ALIGN);
if (!iova_magazine_cache)
goto out_err;
--
2.34.1