public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Linas Vepstas <linasvepstas@gmail.com>,
	"Oliver O'Halloran" <oohall@gmail.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-pci@vger.kernel.org,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Pierre Morel <pmorel@linux.ibm.com>
Subject: [PATCH v2 3/4] PCI: Export pci_dev_lock()
Date: Thu, 16 Sep 2021 11:33:35 +0200	[thread overview]
Message-ID: <20210916093336.2895602-4-schnelle@linux.ibm.com> (raw)
In-Reply-To: <20210916093336.2895602-1-schnelle@linux.ibm.com>

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().

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.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 ce2ab62b64cf..6fe810fdb796 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5059,12 +5059,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 cd8aa6fce204..c27c8fd1d30c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1671,6 +1671,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.25.1


  parent reply	other threads:[~2021-09-16  9:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16  9:33 [PATCH v2 0/4] s390/pci: automatic error recovery Niklas Schnelle
2021-09-16  9:33 ` [PATCH v2 1/4] s390/pci: refresh function handle in iomap Niklas Schnelle
2021-09-16  9:33 ` [PATCH v2 2/4] s390/pci: implement reset_slot for hotplug slot Niklas Schnelle
2021-09-16  9:33 ` Niklas Schnelle [this message]
2021-09-28  9:44   ` [PATCH v2 3/4] PCI: Export pci_dev_lock() Niklas Schnelle
2021-09-28 18:10   ` Bjorn Helgaas
2021-09-16  9:33 ` [PATCH v2 4/4] s390/pci: implement minimal PCI error recovery Niklas Schnelle
2021-09-28 18:11   ` Bjorn Helgaas
2021-09-28 18:30     ` Niklas Schnelle
2021-09-28 18:39       ` Bjorn Helgaas
2021-09-28 18:50         ` Niklas Schnelle

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=20210916093336.2895602-4-schnelle@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=linasvepstas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=oohall@gmail.com \
    --cc=pmorel@linux.ibm.com \
    /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