Re: [PATCH 3/9] vfio/mdev: Pass in a struct vfio_device * to vfio_pin/unpin_pages()

Jason Gunthorpe
2022-04-19T17:04:27Z

On Mon, Apr 18, 2022 at 11:25:15AM -0400, Jason J. Herne wrote:
> On 4/12/22 11:53, Jason Gunthorpe wrote:
> > Every caller has a readily available vfio_device pointer, use that instead
> > of passing in a generic struct device. The struct vfio_device already
> > contains the group we need so this avoids complexity, extra refcountings,
> > and a confusing lifecycle model.
> > ...
> > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> > index 69768061cd7bd9..a10b3369d76c41 100644
> > +++ b/drivers/s390/crypto/vfio_ap_ops.c
> > @@ -124,7 +124,7 @@ static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q)
> > q->saved_isc = VFIO_AP_ISC_INVALID;
> > }
> > if (q->saved_pfn && !WARN_ON(!q->matrix_mdev)) {
> > - vfio_unpin_pages(mdev_dev(q->matrix_mdev->mdev),
> > + vfio_unpin_pages(&q->matrix_mdev->vdev,
> > &q->saved_pfn, 1);
>
> Could be contracted to a single line. If you feel like it :)

Done, thanks

Jason