Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, Philipp Stanner <phasta@kernel.org>
Subject: [PATCH 3/3] PCI: Deprecate pcim_pin_device()
Date: Tue,  1 Dec 2026 13:29:52 +0100	[thread overview]
Message-ID: <20261201122951.904104-5-phasta@kernel.org> (raw)
In-Reply-To: <20261201122951.904104-2-phasta@kernel.org>

pcim_pin_device() reverts the action set up by pcim_enable_device(),
namely that the device gets disabled on driver unload.

This makes the PCI devres API inconsistent and confusing. Who does not
want automatic disablement of the device, should not use a function that
sets up automatic disablement. In other words, whoever needs
pcim_pin_device() just should use pci_enable_device() over
pcim_enable_device().

Mark pcim_pin_device() as deprecated.

Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
 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 afc7e966bb32..b6e81ee72943 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -397,11 +397,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 and should be removed. If you're ever in a
+ * position where it seems useful, you should manage your device enablement
+ * fully manually, with pci_enable_device() and pci_disable_device().
  */
 void pcim_pin_device(struct pci_dev *pdev)
 {
-- 
2.56.0


  parent reply	other threads:[~2026-12-01 12:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 12:29 [PATCH 0/3] PCI: Improve devres documentation Philipp Stanner
2026-12-01 12:29 ` [PATCH 1/3] PCI: Deprecate public devres reversal functions Philipp Stanner
2026-12-01 12:40   ` sashiko-bot
2026-12-01 12:29 ` [PATCH 2/3] PCI: Better document pcim_enable_device() Philipp Stanner
2026-12-01 12:29 ` Philipp Stanner [this message]
2026-12-01 12:40 ` [PATCH 0/3] PCI: Improve devres documentation sashiko-bot

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=20261201122951.904104-5-phasta@kernel.org \
    --to=phasta@kernel.org \
    --cc=bhelgaas@google.com \
    --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