]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
PCI: Remove devres from pci_intx()
authorPhilipp Stanner <pstanner@redhat.com>
Mon, 9 Dec 2024 13:06:33 +0000 (14:06 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 18 Jan 2025 20:38:49 +0000 (14:38 -0600)
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>
14 files changed:
drivers/misc/cardreader/rtsx_pcr.c
drivers/misc/tifm_7xx1.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/brocade/bna/bnad.c
drivers/ntb/hw/amd/ntb_hw_amd.c
drivers/ntb/hw/intel/ntb_hw_gen1.c
drivers/pci/devres.c
drivers/pci/msi/api.c
drivers/pci/msi/msi.c
drivers/pci/pci.c
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/pci/vfio_pci_intrs.c
drivers/xen/xen-pciback/conf_space_header.c
include/linux/pci.h

index e25e6d560dd7b2275b21f361741a091a69c32354..be3d4e0e50ccd60cae77f983776fccc8e2a566a3 100644 (file)
@@ -1057,7 +1057,7 @@ static int rtsx_pci_acquire_irq(struct rtsx_pcr *pcr)
        }
 
        pcr->irq = pcr->pci->irq;
-       pci_intx_unmanaged(pcr->pci, !pcr->msi_en);
+       pci_intx(pcr->pci, !pcr->msi_en);
 
        return 0;
 }
index 5f9c7ccae8d2e52f6642be338d30c8bec08ec5a1..1d54680d6ed20e0265ab5ffe93b7c3ce0378ba79 100644 (file)
@@ -327,7 +327,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
                goto err_out;
        }
 
-       pci_intx_unmanaged(dev, 1);
+       pci_intx(dev, 1);
 
        fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
                                ? 4 : 2, &dev->dev);
@@ -368,7 +368,7 @@ err_out_unmap:
 err_out_free:
        tifm_free_adapter(fm);
 err_out_int:
-       pci_intx_unmanaged(dev, 0);
+       pci_intx(dev, 0);
        pci_release_regions(dev);
 err_out:
        if (!pci_dev_busy)
@@ -392,7 +392,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev)
                tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt));
 
        iounmap(fm->addr);
-       pci_intx_unmanaged(dev, 0);
+       pci_intx(dev, 0);
        pci_release_regions(dev);
 
        pci_disable_device(dev);
index 2ae63d6e679258587f0e586c8133c116fa484e53..678829646cec393cc1bffd844866b5fdf591e472 100644 (file)
@@ -1669,7 +1669,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp)
        REG_WR(bp, IGU_REG_PF_CONFIGURATION, val);
 
        if (val & IGU_PF_CONF_INT_LINE_EN)
-               pci_intx_unmanaged(bp->pdev, true);
+               pci_intx(bp->pdev, true);
 
        barrier();
 
index 2b37462d406ed78cf968b0a031406f5325335e42..ece6f3b483273832bc2fd0fe611e4bab15843ff6 100644 (file)
@@ -2669,7 +2669,7 @@ bnad_enable_msix(struct bnad *bnad)
                }
        }
 
-       pci_intx_unmanaged(bnad->pcidev, 0);
+       pci_intx(bnad->pcidev, 0);
 
        return;
 
index b146f170e8397624d1057b90b2a6cec85b6cfec1..d687e8c2cc78dcd65d26c20c1e2f69ec85c6a37a 100644 (file)
@@ -791,7 +791,7 @@ err_msi_request:
 err_msi_enable:
 
        /* Try to set up intx irq */
-       pci_intx_unmanaged(pdev, 1);
+       pci_intx(pdev, 1);
 
        rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
                         "ndev_irq_isr", ndev);
@@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev)
                if (pci_dev_msi_enabled(pdev))
                        pci_disable_msi(pdev);
                else
-                       pci_intx_unmanaged(pdev, 0);
+                       pci_intx(pdev, 0);
        }
 }
 
index 9ad9d7fe227eb6d77bb1189879413e212934da17..079b8cd79785731e85ff0added66b132e4cd0f27 100644 (file)
@@ -445,7 +445,7 @@ err_msi_enable:
 
        /* Try to set up intx irq */
 
-       pci_intx_unmanaged(pdev, 1);
+       pci_intx(pdev, 1);
 
        rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
                         "ndev_irq_isr", ndev);
index f9b93d1147f10c72d765195805d80e6cd41be6f4..d1d97a4bb36d38af260ef485b7e765cedd6813da 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 c95e2e7dc9ab4c1cf4dd788d39ea45db2eef9d52..b956ce591f964b41a7cac5e563dc7a2747026907 100644 (file)
@@ -289,7 +289,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
                         */
                        if (affd)
                                irq_create_affinity_masks(1, affd);
-                       pci_intx_unmanaged(dev, 1);
+                       pci_intx(dev, 1);
                        return 1;
                }
        }
index 53f13b09db500e039f5fac5d9a158eac77adfc32..3a45879d85db9613d112b6d888d3e9211cbcb705 100644 (file)
@@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(pci_write_msi_msg);
 static void pci_intx_for_msi(struct pci_dev *dev, int enable)
 {
        if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
-               pci_intx_unmanaged(dev, enable);
+               pci_intx(dev, enable);
 }
 
 static void pci_msi_set_enable(struct pci_dev *dev, int enable)
index 3f384e9137e3f2f97b60fe9e383d95f0dfc72e0b..1afe310e86ef0805790e9f9bfa5b2941b409540d 100644 (file)
@@ -4480,17 +4480,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;
 
@@ -4506,41 +4502,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 90240c8d51aaaba289193384b81a4265a14aa444..1ab58da9f38a6eae6077cbb88efb1d667215efee 100644 (file)
@@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
                if (vfio_pci_nointx(pdev)) {
                        pci_info(pdev, "Masking broken INTx support\n");
                        vdev->nointx = true;
-                       pci_intx_unmanaged(pdev, 0);
+                       pci_intx(pdev, 0);
                } else
                        vdev->pci_2_3 = pci_intx_mask_supported(pdev);
        }
index 40abb0b937a2757129932f543f7cb82a6fce7ee6..8382c583433565f9cecbed9fefbd0cbbcbcc809f 100644 (file)
@@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
         */
        if (unlikely(!is_intx(vdev))) {
                if (vdev->pci_2_3)
-                       pci_intx_unmanaged(pdev, 0);
+                       pci_intx(pdev, 0);
                goto out_unlock;
        }
 
@@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
                 * mask, not just when something is pending.
                 */
                if (vdev->pci_2_3)
-                       pci_intx_unmanaged(pdev, 0);
+                       pci_intx(pdev, 0);
                else
                        disable_irq_nosync(pdev->irq);
 
@@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data)
         */
        if (unlikely(!is_intx(vdev))) {
                if (vdev->pci_2_3)
-                       pci_intx_unmanaged(pdev, 1);
+                       pci_intx(pdev, 1);
                goto out_unlock;
        }
 
@@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
         */
        ctx->masked = vdev->virq_disabled;
        if (vdev->pci_2_3) {
-               pci_intx_unmanaged(pdev, !ctx->masked);
+               pci_intx(pdev, !ctx->masked);
                irqflags = IRQF_SHARED;
        } else {
                irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0;
@@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
         * via their shutdown paths.  Restore for NoINTx devices.
         */
        if (vdev->nointx)
-               pci_intx_unmanaged(pdev, 0);
+               pci_intx(pdev, 0);
 
        vdev->irq_type = VFIO_PCI_NUM_IRQS;
 }
index 8d26d64232e86d8ea433a503f04d63b846d8f58d..fc0332645966443d2e5c7256c76b488a0b7a783b 100644 (file)
@@ -106,7 +106,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 
        if (dev_data && dev_data->allow_interrupt_control &&
            ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE))
-               pci_intx_unmanaged(dev, !(value & PCI_COMMAND_INTX_DISABLE));
+               pci_intx(dev, !(value & PCI_COMMAND_INTX_DISABLE));
 
        cmd->val = value;
 
index b5eb8bda655dcdf14420123968d641afc904f630..f05903dd7695ef7aae673d36f579294161a9ef89 100644 (file)
@@ -1350,7 +1350,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);