Messages in this thread | | | From | "Tian, Kevin" <> | Subject | RE: [PATCH v2 09/14] vfio-iommufd: Add detach_ioas support for physical VFIO devices | Date | Tue, 7 Feb 2023 06:06:55 +0000 |
| |
> From: Liu, Yi L <yi.l.liu@intel.com> > Sent: Monday, February 6, 2023 5:05 PM > > +static void __vfio_iommufd_detach(struct vfio_device *vdev) > +{ > + iommufd_device_detach(vdev->iommufd_device); > + vdev->iommufd_attached = false; > +} > + > void vfio_iommufd_physical_unbind(struct vfio_device *vdev) > { > lockdep_assert_held(&vdev->dev_set->lock); > > - if (vdev->iommufd_attached) { > - iommufd_device_detach(vdev->iommufd_device); > - vdev->iommufd_attached = false; > - } > + if (vdev->iommufd_attached) > + __vfio_iommufd_detach(vdev);
I'm not sure whether this abstraction really improves things.
Just two callers. and the old code reads clearer to me which checks a flag, does something and then clear the flag.
> @@ -74,6 +74,7 @@ struct vfio_device { > * @unbind_iommufd: Opposite of bind_iommufd > * @attach_ioas: Called when attaching device to an IOAS/HWPT managed > by the > * bound iommufd. Undo in unbind_iommufd.
"Undo in unbind_iommufd if @detach_ioas is not called".
> + * @detach_ioas: Opposite of attach_ioas, this is for runtime undo.
remove "this is for runtime undo" which is confusing.
| |