RE: [PATCH v2 01/15] vfio: Add helpers for unifying vfio_device life cycle

Tian, Kevin
2022-09-07T00:43:53Z

> From: Christoph Hellwig
> Sent: Tuesday, September 6, 2022 5:42 PM
>
> What is the point? This adds indirect calls, and actually creates
> more boilerplate code in the drivers. i.g. when using this code there
> is more, and harder to read code.

The point is to align with struct device life cycle when it's introduced
to vfio_device. The object is released via put_device() then what would
be the alternative if the driver doesn't provide a @release callback?

and with @release then naturally @init is also expected.

Most added code is in patch1 for implementing new helpers and
patch15 for introducing struct device.

Remaining addition is relatively small when scattered in each driver
and most is due to creating new functions hence new local variables.

and IMHO the readability is improved as it clearly contains the
init/release logic around the device object.

Thanks
Kevin