linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/5] pci: to export functions needed for nvme reset
@ 2019-12-11  2:34 tsutomu.owa
  0 siblings, 0 replies; only message in thread
From: tsutomu.owa @ 2019-12-11  2:34 UTC (permalink / raw)
  To: linux-nvme, sagi, kbusch, hch; +Cc: tsutomu.owa

This pach exports pci related functions which are convenient to implement
nvme reset functions.

Signed-off-by: Tsutomu OWA <tsutomu.owa@kioxia.com>
---
 drivers/pci/pci.c   | 15 ++++++++++-----
 drivers/pci/probe.c |  3 ++-
 include/linux/pci.h |  6 ++++++
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e87196cc1..543dd1991 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1020,7 +1020,7 @@ void pci_wakeup_bus(struct pci_bus *bus)
 		pci_walk_bus(bus, pci_wakeup, NULL);
 }
 
-static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout)
+int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout)
 {
 	int delay = 1;
 	u32 id;
@@ -1060,6 +1060,7 @@ static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(pci_dev_wait);
 
 /**
  * pci_power_up - Put the given device into D0
@@ -4874,12 +4875,13 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe)
 	return pci_reset_hotplug_slot(dev->slot->hotplug, 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 */
 static int pci_dev_trylock(struct pci_dev *dev)
@@ -4893,13 +4895,14 @@ static int pci_dev_trylock(struct pci_dev *dev)
 	return 0;
 }
 
-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)
+void pci_dev_save_and_disable(struct pci_dev *dev)
 {
 	const struct pci_error_handlers *err_handler =
 			dev->driver ? dev->driver->err_handler : NULL;
@@ -4929,8 +4932,9 @@ static void pci_dev_save_and_disable(struct pci_dev *dev)
 	 */
 	pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
 }
+EXPORT_SYMBOL_GPL(pci_dev_save_and_disable);
 
-static void pci_dev_restore(struct pci_dev *dev)
+void pci_dev_restore(struct pci_dev *dev)
 {
 	const struct pci_error_handlers *err_handler =
 			dev->driver ? dev->driver->err_handler : NULL;
@@ -4945,6 +4949,7 @@ static void pci_dev_restore(struct pci_dev *dev)
 	if (err_handler && err_handler->reset_done)
 		err_handler->reset_done(dev);
 }
+EXPORT_SYMBOL_GPL(pci_dev_restore);
 
 /**
  * __pci_reset_function_locked - reset a PCI device function while holding
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 512cb4312..2156d3d8f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2116,7 +2116,7 @@ static void pci_configure_serr(struct pci_dev *dev)
 	}
 }
 
-static void pci_configure_device(struct pci_dev *dev)
+void pci_configure_device(struct pci_dev *dev)
 {
 	pci_configure_mps(dev);
 	pci_configure_extended_tags(dev, NULL);
@@ -2135,6 +2135,7 @@ static void pci_release_capabilities(struct pci_dev *dev)
 	pci_iov_release(dev);
 	pci_free_cap_save_buffers(dev);
 }
+EXPORT_SYMBOL_GPL(pci_configure_device);
 
 /**
  * pci_release_dev - Free a PCI device structure when all users of it are
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c393dff2d..32651b29c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1172,6 +1172,7 @@ bool pci_check_and_mask_intx(struct pci_dev *dev);
 bool pci_check_and_unmask_intx(struct pci_dev *dev);
 int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask);
 int pci_wait_for_pending_transaction(struct pci_dev *dev);
+int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout);
 int pcix_get_max_mmrbc(struct pci_dev *dev);
 int pcix_get_mmrbc(struct pci_dev *dev);
 int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
@@ -1194,6 +1195,10 @@ int pci_probe_reset_bus(struct pci_bus *bus);
 int pci_reset_bus(struct pci_dev *dev);
 void pci_reset_secondary_bus(struct pci_dev *dev);
 void pcibios_reset_secondary_bus(struct pci_dev *dev);
+void pci_dev_lock(struct pci_dev *dev);
+void pci_dev_unlock(struct pci_dev *dev);
+void pci_dev_save_and_disable(struct pci_dev *dev);
+void pci_dev_restore(struct pci_dev *dev);
 void pci_update_resource(struct pci_dev *dev, int resno);
 int __must_check pci_assign_resource(struct pci_dev *dev, int i);
 int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
@@ -1248,6 +1253,7 @@ void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state);
 /* For use by arch with custom probe code */
 void set_pcie_port_type(struct pci_dev *pdev);
 void set_pcie_hotplug_bridge(struct pci_dev *pdev);
+void pci_configure_device(struct pci_dev *dev);
 
 /* Functions for PCI Hotplug drivers to use */
 int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
-- 
2.17.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-11  2:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  2:34 [RFC PATCH 1/5] pci: to export functions needed for nvme reset tsutomu.owa

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