[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7c5fc87d-0025-4770-86f6-8b48ebfd817e@amd.com>
Date: Mon, 21 Oct 2024 12:26:54 +1100
From: Alexey Kardashevskiy <aik@....com>
To: Jason Gunthorpe <jgg@...dia.com>, Nicolin Chen <nicolinc@...dia.com>
Cc: kevin.tian@...el.com, will@...nel.org, joro@...tes.org,
suravee.suthikulpanit@....com, robin.murphy@....com, dwmw2@...radead.org,
baolu.lu@...ux.intel.com, shuah@...nel.org, linux-kernel@...r.kernel.org,
iommu@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kselftest@...r.kernel.org, eric.auger@...hat.com,
jean-philippe@...aro.org, mdf@...nel.org, mshavit@...gle.com,
shameerali.kolothum.thodi@...wei.com, smostafa@...gle.com,
yi.l.liu@...el.com, patches@...ts.linux.dev
Subject: Re: [PATCH v3 02/11] iommufd: Rename _iommufd_object_alloc to
iommufd_object_alloc_elm
On 18/10/24 02:37, Jason Gunthorpe wrote:
> On Thu, Oct 17, 2024 at 11:14:16AM -0300, Jason Gunthorpe wrote:
>> On Wed, Oct 09, 2024 at 09:38:02AM -0700, Nicolin Chen wrote:
>>
>>> @@ -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);
>>
>> Maybe call it raw instead of elm? elm suggests it is an item in an
>> array or likewise
>
> Or keep this as the __ and rename
>
> #define __iommufd_object_alloc(ictx, ptr, type, obj) \
>
> That one to _elm like this:
>
> #define iommufd_object_alloc_elm(ictx, ptr, type, elm) \
> container_of(_iommufd_object_alloc( \
> ictx, \
> sizeof(*(ptr)) + BUILD_BUG_ON_ZERO( \
> offsetof(typeof(*(ptr)), \
> obj) != 0), \
> type), \
> typeof(*(ptr)), elm)
>
> #define iommufd_object_alloc(ictx, ptr, type) \
> iommufd_object_alloc_elm(ictx, ptr, type, obj)
Bikeshedding, yay :)
After starring at it for 10min - honestly - ditch
iommufd_object_alloc_elm() and just pass "obj" (or "common.obj" in that
single other occasion) to iommufd_object_alloc().
__iommufd_object_alloc() - a function - will the actual alloc,
iommufd_object_alloc() - a macro - will do the types + call the __
variant, simple and no naming issues.
And it would be real nice if it was "iobj" not this "obj" which is way
too generic. Thanks,
> Then you can keep the pattern of _ being the allocation function of
> the macro
>
> Jason
--
Alexey
Powered by blists - more mailing lists