Re: [PATCH 03/10] vfio/platform: Use vfio_init/register/unregister_group_dev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 10, 2021 at 08:28:50AM +0100, Christoph Hellwig wrote:
> On Tue, Mar 09, 2021 at 05:38:45PM -0400, Jason Gunthorpe wrote:
> > platform already allocates a struct vfio_platform_device with exactly
> > the same lifetime as vfio_device, switch to the new API and embed
> > vfio_device in vfio_platform_device.
> > 
> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> >  drivers/vfio/platform/vfio_amba.c             |  8 ++++---
> >  drivers/vfio/platform/vfio_platform.c         | 21 ++++++++---------
> >  drivers/vfio/platform/vfio_platform_common.c  | 23 +++++++------------
> >  drivers/vfio/platform/vfio_platform_private.h |  5 ++--
> >  4 files changed, 26 insertions(+), 31 deletions(-)
> > 
> > diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
> > index 3626c21501017e..f970eb2a999f29 100644
> > +++ b/drivers/vfio/platform/vfio_amba.c
> > @@ -66,16 +66,18 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
> >  	if (ret) {
> >  		kfree(vdev->name);
> >  		kfree(vdev);
> > +		return ret;
> >  	}
> >  
> > -	return ret;
> > +	dev_set_drvdata(&adev->dev, vdev);
> > +	return 0;
> 
> Switching to goto based unwind here would be helpful as well..

Hurm. Lets just delete vfio_platform_device->name.

It is only used for a few diagnostic prints and in all those cases the
print is already a dev_XX on the parent:

-               dev_err(dev, "ACPI companion device not found for %s\n",
-                       vdev->name);

Here dev == vdev->dev.dev. So on platform this prints

foo_platform_device.0: ACPI companion device not found for foo_platform_device

AMBA will print the periphid, but someone who needs that can find it
in the sysfs from the parent name. I wrote a patch and will include it
in some follow up series

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux