>-----Original Message----- >From: Nicolin Chen <nicol...@nvidia.com> >Sent: Thursday, August 17, 2023 1:26 PM >Subject: Re: [RFC PATCH v4 22/24] vfio/pci: Adapt vfio pci hot reset support >with iommufd BE > >On Wed, Jul 12, 2023 at 03:25:26PM +0800, Zhenzhong Duan wrote: > >> +#ifdef CONFIG_IOMMUFD >> +static VFIODevice *vfio_pci_iommufd_binded(__u32 devid) >> +{ >> + VFIOAddressSpace *space; >> + VFIOContainer *bcontainer; >> + VFIOIOMMUFDContainer *container; >> + VFIOIOASHwpt *hwpt; >> + VFIODevice *vbasedev_iter; >> + VFIOIOMMUBackendOpsClass *ops = >VFIO_IOMMU_BACKEND_OPS_CLASS( >> + >object_class_by_name(TYPE_VFIO_IOMMU_BACKEND_IOMMUFD_OPS)); >> + >> + QLIST_FOREACH(space, &vfio_address_spaces, list) { > >Indentation here doesn't seem to be aligned with the lines above. > >> + QLIST_FOREACH(bcontainer, &space->containers, next) { >> + if (bcontainer->ops != ops) { >> + continue; >> + } >> + container = container_of(bcontainer, VFIOIOMMUFDContainer, >> + bcontainer); >> + QLIST_FOREACH(hwpt, &container->hwpt_list, next) { >> + QLIST_FOREACH(vbasedev_iter, &hwpt->device_list, next) { >> + if (devid == vbasedev_iter->devid) { >> + return vbasedev_iter; >> + } >> + } >> + } >> + } >> + } >> + return NULL; >> +} > >By a quick look, the "binded" sounds a bit odd to me. And this >function could be vfio_pci_find_by_iommufd_devid()?
Sorry about my poor English, yes, vfio_pci_find_by_iommufd_devid is better, I'll use it as function name. Thanks Zhenzhong