Re: [PATCH v3 01/15] vfio: Add helpers for unifying vfio_device life cycle

From: Jason Gunthorpe
Date: Fri Sep 09 2022 - 19:53:20 EST


On Fri, Sep 09, 2022 at 08:42:25AM +0000, Tian, Kevin wrote:

> I think it's quite common to have an alloc() helper initialize refcount, e.g.
> vfio_group_alloc() both initialize its user refcount and also call
> device_initialize() to gets kref initialized. Similar example in
> ib_alloc_device(), etc.

Right, it is quite a good/common pattern to have an allocation function
return a refcount to the caller.

I don't know of any naming standard for this however.

Jason