Commit dfd5bb23 authored by Niklas Schnelle's avatar Niklas Schnelle Committed by Vasily Gorbik

PCI: Export pci_dev_lock()

Commit e3a9b121 ("PCI: Export pci_dev_trylock() and pci_dev_unlock()")
already exported pci_dev_trylock()/pci_dev_unlock() however in some
circumstances such as during error recovery it makes sense to block
waiting to get full access to the device so also export pci_dev_lock().

Link: https://lore.kernel.org/all/20210928181014.GA713179@bhelgaas/Acked-by: default avatarPierre Morel <pmorel@linux.ibm.com>
Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent da995d53
...@@ -5074,12 +5074,13 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool probe) ...@@ -5074,12 +5074,13 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool probe)
return pci_parent_bus_reset(dev, probe); return pci_parent_bus_reset(dev, probe);
} }
static void pci_dev_lock(struct pci_dev *dev) void pci_dev_lock(struct pci_dev *dev)
{ {
pci_cfg_access_lock(dev); pci_cfg_access_lock(dev);
/* block PM suspend, driver probe, etc. */ /* block PM suspend, driver probe, etc. */
device_lock(&dev->dev); device_lock(&dev->dev);
} }
EXPORT_SYMBOL_GPL(pci_dev_lock);
/* Return 1 on successful lock, 0 on contention */ /* Return 1 on successful lock, 0 on contention */
int pci_dev_trylock(struct pci_dev *dev) int pci_dev_trylock(struct pci_dev *dev)
......
...@@ -1664,6 +1664,7 @@ void pci_cfg_access_lock(struct pci_dev *dev); ...@@ -1664,6 +1664,7 @@ void pci_cfg_access_lock(struct pci_dev *dev);
bool pci_cfg_access_trylock(struct pci_dev *dev); bool pci_cfg_access_trylock(struct pci_dev *dev);
void pci_cfg_access_unlock(struct pci_dev *dev); void pci_cfg_access_unlock(struct pci_dev *dev);
void pci_dev_lock(struct pci_dev *dev);
int pci_dev_trylock(struct pci_dev *dev); int pci_dev_trylock(struct pci_dev *dev);
void pci_dev_unlock(struct pci_dev *dev); void pci_dev_unlock(struct pci_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment