From: Luis Chamberlain <mcgrof@kernel.org>
To: bhelgaas@google.com, alex.williamson@redhat.com,
cohuck@redhat.com, jgg@ziepe.ca, kevin.tian@intel.com,
eric.auger@redhat.com, giovanni.cabiddu@intel.com,
mjrosato@linux.ibm.com, jannh@google.com, kvm@vger.kernel.org,
linux-pci@vger.kernel.org, schnelle@linux.ibm.com
Cc: minchan@kernel.org, gregkh@linuxfoundation.org,
rafael@kernel.org, jeyu@kernel.org, ngupta@vflare.org,
sergey.senozhatsky.work@gmail.com, mcgrof@kernel.org,
axboe@kernel.dk, mbenes@suse.com, jpoimboe@redhat.com,
tglx@linutronix.de, keescook@chromium.org, jikos@kernel.org,
rostedt@goodmis.org, peterz@infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock()
Date: Tue, 22 Jun 2021 19:28:23 -0700 [thread overview]
Message-ID: <20210623022824.308041-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20210623022824.308041-1-mcgrof@kernel.org>
Other places in the kernel use this form, and so just
provide a common path for it.
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/pci/pci.c | 6 ++++--
include/linux/pci.h | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index f09821af1d2e..b1d9bb3f5ae2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5027,7 +5027,7 @@ static void pci_dev_lock(struct pci_dev *dev)
}
/* Return 1 on successful lock, 0 on contention */
-static int pci_dev_trylock(struct pci_dev *dev)
+int pci_dev_trylock(struct pci_dev *dev)
{
if (pci_cfg_access_trylock(dev)) {
if (device_trylock(&dev->dev))
@@ -5037,12 +5037,14 @@ static int pci_dev_trylock(struct pci_dev *dev)
return 0;
}
+EXPORT_SYMBOL_GPL(pci_dev_trylock);
-static void pci_dev_unlock(struct pci_dev *dev)
+void pci_dev_unlock(struct pci_dev *dev)
{
device_unlock(&dev->dev);
pci_cfg_access_unlock(dev);
}
+EXPORT_SYMBOL_GPL(pci_dev_unlock);
static void pci_dev_save_and_disable(struct pci_dev *dev)
{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6248e044dd29..d8f056f3a2e3 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1622,6 +1622,9 @@ 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);
+int pci_dev_trylock(struct pci_dev *dev);
+void pci_dev_unlock(struct pci_dev *dev);
+
/*
* PCI domain support. Sometimes called PCI segment (eg by ACPI),
* a PCI domain is defined to be a set of PCI buses which share
--
2.30.2
next prev parent reply other threads:[~2021-06-23 2:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 2:28 [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Luis Chamberlain
2021-06-23 2:28 ` Luis Chamberlain [this message]
2021-06-23 9:30 ` [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock() Cornelia Huck
2021-06-23 2:28 ` [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
2021-06-23 9:31 ` Cornelia Huck
2021-06-23 18:20 ` Jason Gunthorpe
2021-06-23 18:17 ` [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Alex Williamson
2021-06-25 15:04 ` Alex Williamson
2021-06-25 15:07 ` Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210623022824.308041-2-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=alex.williamson@redhat.com \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=cohuck@redhat.com \
--cc=eric.auger@redhat.com \
--cc=giovanni.cabiddu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=jeyu@kernel.org \
--cc=jgg@ziepe.ca \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mbenes@suse.com \
--cc=minchan@kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=ngupta@vflare.org \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=schnelle@linux.ibm.com \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).