diff mbox series

[RFC,v1,3/3] PCI: Hide pci_reset_function_locked()

Message ID 20181019032345.5791-3-okaya@kernel.org (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series [RFC,v1,1/3] PCI: Unify pci_reset_function_locked() and __pci_reset_function_locked() | expand

Commit Message

Sinan Kaya Oct. 19, 2018, 3:23 a.m. UTC
It is time to hide pci_reset_function_locked() since pci_reset_function()
provides the same functionality. One less API to expose to the users.

Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
 drivers/infiniband/hw/hfi1/pcie.c               |  5 +++--
 drivers/net/ethernet/cavium/liquidio/lio_main.c |  6 +++---
 drivers/pci/pci.h                               |  1 +
 drivers/xen/xen-pciback/pci_stub.c              | 13 +++++++------
 include/linux/pci.h                             |  1 -
 5 files changed, 14 insertions(+), 12 deletions(-)

Comments

Jürgen Groß Oct. 19, 2018, 8:12 a.m. UTC | #1
On 19/10/2018 05:23, Sinan Kaya wrote:
> It is time to hide pci_reset_function_locked() since pci_reset_function()
> provides the same functionality. One less API to expose to the users.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>

Did you try to compile that?

You are mixing use of PCI_RESET_ALREADY_LOCKED and
PCI_RESET_ALREADYLOCKED, and I can't imagine both are valid.


Juergen
Sinan Kaya Oct. 19, 2018, 1:45 p.m. UTC | #2
On 10/19/2018 4:12 AM, Juergen Gross wrote:
> On 19/10/2018 05:23, Sinan Kaya wrote:
>> It is time to hide pci_reset_function_locked() since pci_reset_function()
>> provides the same functionality. One less API to expose to the users.
>>
>> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> 
> Did you try to compile that?
> 
> You are mixing use of PCI_RESET_ALREADY_LOCKED and
> PCI_RESET_ALREADYLOCKED, and I can't imagine both are valid.

You are right, I did compile. However, not all kernel options were
enabled apparently. I should have done allyesconfig.

Thanks for the heads up. I can fix it on the next rev.

> 
> 
> Juergen
>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
index a43cd031bfe4..298086b7936b 100644
--- a/drivers/infiniband/hw/hfi1/pcie.c
+++ b/drivers/infiniband/hw/hfi1/pcie.c
@@ -897,8 +897,9 @@  static int trigger_sbr(struct hfi1_devdata *dd)
 	 * to be implemented to have cleaner interface but this fixes the
 	 * current brokenness
 	 */
-	return pci_reset_function_locked(dev, PCI_RESET_LINK |
-					      PCI_RESET_NOSAVERESTORE);
+	return pci_reset_function(dev, PCI_RESET_LINK |
+				       PCI_RESET_NOSAVERESTORE |
+				       PCI_RESET_ALREADY_LOCKED);
 }
 
 /*
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 4ae3935ff10d..605061b2ee66 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -989,9 +989,9 @@  static void octeon_pci_flr(struct octeon_device *oct)
 	pci_write_config_word(oct->pci_dev, PCI_COMMAND,
 			      PCI_COMMAND_INTX_DISABLE);
 
-	rc = pci_reset_function_locked(oct->pci_dev, PCI_RESET_ANY |
-						     PCI_RESET_NOSAVERESTORE);
-
+	rc = pci_reset_function(oct->pci_dev, PCI_RESET_ANY |
+					      PCI_RESET_NOSAVERESTORE |
+					      PCI_RESET_ALREADYLOCKED);
 	if (rc != 0)
 		dev_err(&oct->pci_dev->dev, "Error %d resetting PCI function %d\n",
 			rc, oct->pf_num);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index fbfb44fb32b7..e6eefc028ba2 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -36,6 +36,7 @@  int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vmai,
 int pci_probe_reset_function(struct pci_dev *dev, u32 reset_type);
 int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
 int __pci_reset_function_locked(struct pci_dev *dev, u32 reset_type);
+int pci_reset_function_locked(struct pci_dev *dev, u32 reset_type);
 
 /**
  * struct pci_platform_pm_ops - Firmware PM callbacks
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 7a27d8fb0528..a43476447809 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -105,8 +105,8 @@  static void pcistub_device_release(struct kref *kref)
 	/* Call the reset function which does not take lock as this
 	 * is called from "unbind" which takes a device_lock mutex.
 	 */
-	pci_reset_function_locked(dev, PCI_RESET_ANY |
-				       PCI_RESET_NOSAVERESTORE);
+	pci_reset_function(dev, PCI_RESET_ANY | PCI_RESET_NOSAVERESTORE |
+				PCI_RESET_ALREADY_LOCKED);
 	if (pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state))
 		dev_info(&dev->dev, "Could not reload PCI state\n");
 	else
@@ -284,8 +284,8 @@  void pcistub_put_pci_dev(struct pci_dev *dev)
 	 * (so it's ready for the next domain)
 	 */
 	device_lock_assert(&dev->dev);
-	pci_reset_function_locked(dev, PCI_RESET_ANY |
-				       PCI_RESET_NOSAVERESTORE);
+	pci_reset_function(dev, PCI_RESET_ANY | PCI_RESET_NOSAVERESTORE |
+				PCI_RESET_ALREADYLOCKED);
 
 	dev_data = pci_get_drvdata(dev);
 	ret = pci_load_saved_state(dev, dev_data->pci_saved_state);
@@ -419,8 +419,9 @@  static int pcistub_init_device(struct pci_dev *dev)
 		dev_err(&dev->dev, "Could not store PCI conf saved state!\n");
 	else {
 		dev_dbg(&dev->dev, "resetting (FLR, D3, etc) the device\n");
-		pci_reset_function_locked(dev, PCI_RESET_ANY |
-					       PCI_RESET_NOSAVERESTORE);
+		pci_reset_function(dev,	PCI_RESET_ANY |
+					PCI_RESET_NOSAVERESTORE |
+					PCI_RESET_ALREADYLOCKED);
 		pci_restore_state(dev);
 	}
 	/* Now disable the device (this also ensures some private device
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ad5996d521eb..f93007f71ed7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1176,7 +1176,6 @@  void pcie_print_link_status(struct pci_dev *dev);
 bool pcie_has_flr(struct pci_dev *dev);
 int pcie_flr(struct pci_dev *dev);
 int pci_reset_function(struct pci_dev *dev, u32 reset_type);
-int pci_reset_function_locked(struct pci_dev *dev, u32 reset_type);
 int pci_try_reset_function(struct pci_dev *dev, u32 reset_type);
 int pci_probe_reset_slot(struct pci_slot *slot);
 int pci_probe_reset_bus(struct pci_bus *bus);