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

Message ID 20240227090826.82475-1-liucong2@kylinos.cn
State New
Headers
Series iommu/fsl_pamu: Simplify IOVA cache allocation with KMEM_CACHE() in fsl_pamu_domain.c |

Commit Message

Cong Liu Feb. 27, 2024, 9:08 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: Cong Liu <liucong2@kylinos.cn>
---
 drivers/iommu/fsl_pamu_domain.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
  

Patch

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