Skip to contentSkip to conversation

PCI: Deprecate pcim_pin_device()

PATCH New Philipp Stanner 1 participant 1 message Aug 22, 2024 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Deprecate pcim_pin_device()

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.

---
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(-)
drivers/pci/devres.c +5 -1
index 3780a9f9ec00..87a125cc5207 100644
@@ -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)
 {
Signature · 1 line
2.46.0