]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PCI: Remove devres from pci_intx()
authorPhilipp Stanner <pstanner@redhat.com>
Mon, 9 Dec 2024 13:06:33 +0000 (14:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:30:15 +0000 (04:30 -0800)
[ Upstream commit dfa2f4d5f9e5d757700cefa8ee480099889f1c69 ]

pci_intx() is a hybrid function which can sometimes be managed through
devres. This hybrid nature is undesirable.

Since all users of pci_intx() have by now been ported either to
always-managed pcim_intx() or never-managed pci_intx_unmanaged(), the
devres functionality can be removed from pci_intx().

Consequently, pci_intx_unmanaged() is now redundant, because pci_intx()
itself is now unmanaged.

Remove the devres functionality from pci_intx(). Have all users of
pci_intx_unmanaged() call pci_intx(). Remove pci_intx_unmanaged().

Link: https://lore.kernel.org/r/20241209130632.132074-13-pstanner@redhat.com
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: d555ed45a5a1 ("PCI: Restore original INTX_DISABLE bit by pcim_intx()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/devres.c
drivers/pci/pci.c
include/linux/pci.h

index c3699105656a7316c7b43760205f8c4c39d3f97c..70f1a46d07c5ee5344454c7f7de695350221c285 100644 (file)
@@ -416,7 +416,7 @@ static void pcim_intx_restore(struct device *dev, void *data)
        struct pci_dev *pdev = to_pci_dev(dev);
        struct pcim_intx_devres *res = data;
 
-       pci_intx_unmanaged(pdev, res->orig_intx);
+       pci_intx(pdev, res->orig_intx);
 }
 
 static struct pcim_intx_devres *get_or_create_intx_devres(struct device *dev)
@@ -453,7 +453,7 @@ int pcim_intx(struct pci_dev *pdev, int enable)
                return -ENOMEM;
 
        res->orig_intx = !enable;
-       pci_intx_unmanaged(pdev, enable);
+       pci_intx(pdev, enable);
 
        return 0;
 }
index 3916e0b23cdaf4879efa709395d676326556697c..1aa5d6f98ebda26849cacc5e6a580a4074b2a2e1 100644 (file)
@@ -4481,17 +4481,13 @@ void pci_disable_parity(struct pci_dev *dev)
 }
 
 /**
- * pci_intx_unmanaged - enables/disables PCI INTx for device dev,
- * unmanaged version
+ * pci_intx - enables/disables PCI INTx for device dev
  * @pdev: the PCI device to operate on
  * @enable: boolean: whether to enable or disable PCI INTx
  *
  * Enables/disables PCI INTx for device @pdev
- *
- * This function behavios identically to pci_intx(), but is never managed with
- * devres.
  */
-void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
+void pci_intx(struct pci_dev *pdev, int enable)
 {
        u16 pci_command, new;
 
@@ -4507,41 +4503,6 @@ void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
 
        pci_write_config_word(pdev, PCI_COMMAND, new);
 }
-EXPORT_SYMBOL_GPL(pci_intx_unmanaged);
-
-/**
- * pci_intx - enables/disables PCI INTx for device dev
- * @pdev: the PCI device to operate on
- * @enable: boolean: whether to enable or disable PCI INTx
- *
- * Enables/disables PCI INTx for device @pdev
- *
- * NOTE:
- * This is a "hybrid" function: It's normally unmanaged, but becomes managed
- * when pcim_enable_device() has been called in advance. This hybrid feature is
- * DEPRECATED! If you want managed cleanup, use pcim_intx() instead.
- */
-void pci_intx(struct pci_dev *pdev, int enable)
-{
-       u16 pci_command, new;
-
-       pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
-
-       if (enable)
-               new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
-       else
-               new = pci_command | PCI_COMMAND_INTX_DISABLE;
-
-       if (new != pci_command) {
-               /* Preserve the "hybrid" behavior for backwards compatibility */
-               if (pci_is_managed(pdev)) {
-                       WARN_ON_ONCE(pcim_intx(pdev, enable) != 0);
-                       return;
-               }
-
-               pci_write_config_word(pdev, PCI_COMMAND, new);
-       }
-}
 EXPORT_SYMBOL_GPL(pci_intx);
 
 /**
index 6ef32a8d146b1ed40654ac8e7e5150a6528faa93..74114acbb07fbbb7a648ce75cec79c6a89092de7 100644 (file)
@@ -1353,7 +1353,6 @@ int __must_check pcim_set_mwi(struct pci_dev *dev);
 int pci_try_set_mwi(struct pci_dev *dev);
 void pci_clear_mwi(struct pci_dev *dev);
 void pci_disable_parity(struct pci_dev *dev);
-void pci_intx_unmanaged(struct pci_dev *pdev, int enable);
 void pci_intx(struct pci_dev *dev, int enable);
 bool pci_check_and_mask_intx(struct pci_dev *dev);
 bool pci_check_and_unmask_intx(struct pci_dev *dev);