From: Philipp Stanner <pstanner@redhat.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Philipp Stanner <pstanner@redhat.com>
Subject: [PATCH] PCI: Deprecate pcim_pin_device()
Date: Thu, 22 Aug 2024 09:38:16 +0200 [thread overview]
Message-ID: <20240822073815.12365-2-pstanner@redhat.com> (raw)
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 --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
reply other threads:[~2024-08-22 7:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240822073815.12365-2-pstanner@redhat.com \
--to=pstanner@redhat.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox