[PATCH] iommu/fsl_pamu: Simplify IOVA cache allocation with KMEM_CACHE() in fsl_pamu_domain.c

From: Cong Liu
Date: Tue Feb 27 2024 - 04:09:03 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/fsl_pamu_domain.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index e9d2bff4659b..61c47ecfe6b0 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -31,21 +31,13 @@ static struct fsl_dma_domain *to_fsl_dma_domain(struct iommu_domain *dom)

static int __init iommu_init_mempool(void)
{
- fsl_pamu_domain_cache = kmem_cache_create("fsl_pamu_domain",
- sizeof(struct fsl_dma_domain),
- 0,
- SLAB_HWCACHE_ALIGN,
- NULL);
+ fsl_pamu_domain_cache = KMEM_CACHE(fsl_dma_domain, SLAB_HWCACHE_ALIGN);
if (!fsl_pamu_domain_cache) {
pr_debug("Couldn't create fsl iommu_domain cache\n");
return -ENOMEM;
}

- iommu_devinfo_cache = kmem_cache_create("iommu_devinfo",
- sizeof(struct device_domain_info),
- 0,
- SLAB_HWCACHE_ALIGN,
- NULL);
+ iommu_devinfo_cache = KMEM_CACHE(device_domain_info, SLAB_HWCACHE_ALIGN);
if (!iommu_devinfo_cache) {
pr_debug("Couldn't create devinfo cache\n");
kmem_cache_destroy(fsl_pamu_domain_cache);
--
2.34.1