[J][PATCH 5/6] PCI: Export pci_dev_lock()
patricia.domingues at canonical.com
patricia.domingues at canonical.com
Thu Mar 17 15:35:02 UTC 2022
From: Niklas Schnelle <schnelle at linux.ibm.com>
BugLink: https://bugs.launchpad.net/bugs/1959532
Commit e3a9b1212b9d ("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: Pierre Morel <pmorel at linux.ibm.com>
Acked-by: Bjorn Helgaas <bhelgaas at google.com>
Signed-off-by: Niklas Schnelle <schnelle at linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor at linux.ibm.com>
(cherry picked from commit dfd5bb23ad75bdabde89ac3166705a450bf16acb)
Signed-off-by: Patricia Domingues <patricia.domingues at canonical.com>
---
drivers/pci/pci.c | 3 ++-
include/linux/pci.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 9dbf92a7f5aa..9cdbb35dd090 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5092,12 +5092,13 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool 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);
/* block PM suspend, driver probe, etc. */
device_lock(&dev->dev);
}
+EXPORT_SYMBOL_GPL(pci_dev_lock);
/* Return 1 on successful lock, 0 on contention */
int pci_dev_trylock(struct pci_dev *dev)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 72821c023239..84890df788b2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1677,6 +1677,7 @@ void pci_cfg_access_lock(struct pci_dev *dev);
bool pci_cfg_access_trylock(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);
void pci_dev_unlock(struct pci_dev *dev);
--
2.17.1
More information about the kernel-team
mailing list