[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240822073815.12365-2-pstanner@redhat.com>
Date: Thu, 22 Aug 2024 09:38:16 +0200
From: Philipp Stanner <pstanner@...hat.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
Philipp Stanner <pstanner@...hat.com>
Subject: [PATCH] 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.
Signed-off-by: Philipp Stanner <pstanner@...hat.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 --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)
{
--
2.46.0
Powered by blists - more mailing lists