Skip to content

Commit e3a9b12

Browse files
mcgrofawilliam
authored andcommitted
PCI: Export pci_dev_trylock() and pci_dev_unlock()
Other places in the kernel use this form, and so just provide a common path for it. Acked-by: Bjorn Helgaas <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent 0af5160 commit e3a9b12

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

drivers/pci/pci.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5028,7 +5028,7 @@ static void pci_dev_lock(struct pci_dev *dev)
50285028
}
50295029

50305030
/* Return 1 on successful lock, 0 on contention */
5031-
static int pci_dev_trylock(struct pci_dev *dev)
5031+
int pci_dev_trylock(struct pci_dev *dev)
50325032
{
50335033
if (pci_cfg_access_trylock(dev)) {
50345034
if (device_trylock(&dev->dev))
@@ -5038,12 +5038,14 @@ static int pci_dev_trylock(struct pci_dev *dev)
50385038

50395039
return 0;
50405040
}
5041+
EXPORT_SYMBOL_GPL(pci_dev_trylock);
50415042

5042-
static void pci_dev_unlock(struct pci_dev *dev)
5043+
void pci_dev_unlock(struct pci_dev *dev)
50435044
{
50445045
device_unlock(&dev->dev);
50455046
pci_cfg_access_unlock(dev);
50465047
}
5048+
EXPORT_SYMBOL_GPL(pci_dev_unlock);
50475049

50485050
static void pci_dev_save_and_disable(struct pci_dev *dev)
50495051
{

include/linux/pci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,9 @@ void pci_cfg_access_lock(struct pci_dev *dev);
16211621
bool pci_cfg_access_trylock(struct pci_dev *dev);
16221622
void pci_cfg_access_unlock(struct pci_dev *dev);
16231623

1624+
int pci_dev_trylock(struct pci_dev *dev);
1625+
void pci_dev_unlock(struct pci_dev *dev);
1626+
16241627
/*
16251628
* PCI domain support. Sometimes called PCI segment (eg by ACPI),
16261629
* a PCI domain is defined to be a set of PCI buses which share

0 commit comments

Comments
 (0)