diff mbox series

PCI: Deprecate pcim_pin_device()

Message ID 20240822073815.12365-2-pstanner@redhat.com (mailing list archive)
State New
Delegated to: Bjorn Helgaas
Headers show
Series PCI: Deprecate pcim_pin_device() | expand

Commit Message

Philipp Stanner Aug. 22, 2024, 7:38 a.m. UTC
Since commit f748a07a0b64 ("PCI: Remove legacy pcim_release()") the only
thing pcim_enable_device() does is set up the cleanup callback
pcim_disable_device(); the only thing this function in turn does is to
disable the device if it has not been pinned through pcim_pin_device().

Previously, pcim_enable_device() had set up several cleanup callbacks to
iounmap BARs etc., which made pcim_pin_device() necessary. All of that
is now done through separate interfaces, however.

Consequently, everyone who does not want the device to be disabled on
driver detach can now simply use pci_enable_device() instead of
pcim_enable_device().

Mark pcim_pin_device() as deprecated.

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
I am aware that there are only 16 callers.
Porting them right away is a bit tricky, though, since you'd have to
replace their pcim_enable_device(), which still activates
pci_dev.is_managed, which still affects the code in pci.c

So I'd prefer to postpone removing pcim_pin_device() until my ATA
cleanup series is done. All that might take a few releases.

P.
---
 drivers/pci/devres.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index 3780a9f9ec00..87a125cc5207 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -520,11 +520,15 @@  int pcim_enable_device(struct pci_dev *pdev)
 EXPORT_SYMBOL(pcim_enable_device);
 
 /**
- * pcim_pin_device - Pin managed PCI device
+ * pcim_pin_device - Pin managed PCI device (DEPRECATED)
  * @pdev: PCI device to pin
  *
  * Pin managed PCI device @pdev. Pinned device won't be disabled on driver
  * detach. @pdev must have been enabled with pcim_enable_device().
+ *
+ * This function is DEPRECATED. Do not use it in new code. If you want the
+ * device to remain enabled after driver detach, just use pci_enable_device()
+ * instead of pcim_enable_device().
  */
 void pcim_pin_device(struct pci_dev *pdev)
 {