Re: [PATCH v2 15/15] vfio: Add struct device to vfio_device
From: Jason Gunthorpe
Date: Thu Sep 08 2022 - 08:37:20 EST
On Thu, Sep 08, 2022 at 11:39:07AM +0200, Eric Auger wrote:
> >> I am not totally clear about remaining 'struct device *dev;' in
> >> vfio_device struct. I see it used in some places. Is it supposed to
> >> disappear at some point?
> >
> > no, Eric. *dev will not disappear, it stores the dev pointet passed in by
> > caller of vfio_init_device().
>
> yeah I see but you have device->device.parent = device->dev;
IIRC we have a number of these redundancies now, often the drivers
store another copy of the dev too.
A significant use of dev is for printing things, what should be done
here is to create a subsystem wide vfio_warn/etc that takes in the
vfio_device, and then print properly from there. Now that we have a
struct device all the prints should also include the VFIO struct
device name, and then the PCI device perhaps in brackets.
Jason