[PATCH v3 02/11] iommufd: Rename _iommufd_object_alloc to iommufd_object_alloc_elm
From: Nicolin Chen
Date: Wed Oct 09 2024 - 12:39:42 EST
Currently, the object allocation function calls:
level-0: iommufd_object_alloc()
level-1: __iommufd_object_alloc()
level-2: _iommufd_object_alloc()
So the level-1 and level-2 look inverted.
The level-1 allocator is a container_of converter with a pointer sanity,
backing the level-0 allocator. But the level-2 allocator does the actual
object element allocations. Thus, rename the level-2 allocator, so those
two inverted namings would be:
level-0: iommufd_object_alloc()
level-1: __iommufd_object_alloc()
level-2: iommufd_object_alloc_elm()
Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
---
drivers/iommu/iommufd/iommufd_private.h | 8 ++++----
drivers/iommu/iommufd/main.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h
index 7221f81ae211..f2f3a906eac9 100644
--- a/drivers/iommu/iommufd/iommufd_private.h
+++ b/drivers/iommu/iommufd/iommufd_private.h
@@ -217,12 +217,12 @@ iommufd_object_put_and_try_destroy(struct iommufd_ctx *ictx,
iommufd_object_remove(ictx, obj, obj->id, 0);
}
-struct iommufd_object *_iommufd_object_alloc(struct iommufd_ctx *ictx,
- size_t size,
- enum iommufd_object_type type);
+struct iommufd_object *iommufd_object_alloc_elm(struct iommufd_ctx *ictx,
+ size_t size,
+ enum iommufd_object_type type);
#define __iommufd_object_alloc(ictx, ptr, type, obj) \
- container_of(_iommufd_object_alloc( \
+ container_of(iommufd_object_alloc_elm( \
ictx, \
sizeof(*(ptr)) + BUILD_BUG_ON_ZERO( \
offsetof(typeof(*(ptr)), \
diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
index b5f5d27ee963..28e1ef5666e9 100644
--- a/drivers/iommu/iommufd/main.c
+++ b/drivers/iommu/iommufd/main.c
@@ -29,9 +29,9 @@ struct iommufd_object_ops {
static const struct iommufd_object_ops iommufd_object_ops[];
static struct miscdevice vfio_misc_dev;
-struct iommufd_object *_iommufd_object_alloc(struct iommufd_ctx *ictx,
- size_t size,
- enum iommufd_object_type type)
+struct iommufd_object *iommufd_object_alloc_elm(struct iommufd_ctx *ictx,
+ size_t size,
+ enum iommufd_object_type type)
{
struct iommufd_object *obj;
int rc;
--
2.43.0