mirror of https://gitee.com/openkylin/linux.git
vfio: use the new pci_dev_trylock() helper to simplify try lock
Use the new pci_dev_trylock() helper to simplify our locking. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20210623022824.308041-3-mcgrof@kernel.org Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
e3a9b1212b
commit
742b4c0d1e
|
@ -477,13 +477,10 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev)
|
||||||
* We can not use the "try" reset interface here, which will
|
* We can not use the "try" reset interface here, which will
|
||||||
* overwrite the previously restored configuration information.
|
* overwrite the previously restored configuration information.
|
||||||
*/
|
*/
|
||||||
if (vdev->reset_works && pci_cfg_access_trylock(pdev)) {
|
if (vdev->reset_works && pci_dev_trylock(pdev)) {
|
||||||
if (device_trylock(&pdev->dev)) {
|
if (!__pci_reset_function_locked(pdev))
|
||||||
if (!__pci_reset_function_locked(pdev))
|
vdev->needs_reset = false;
|
||||||
vdev->needs_reset = false;
|
pci_dev_unlock(pdev);
|
||||||
device_unlock(&pdev->dev);
|
|
||||||
}
|
|
||||||
pci_cfg_access_unlock(pdev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_restore_state(pdev);
|
pci_restore_state(pdev);
|
||||||
|
|
Loading…
Reference in New Issue