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>
        }
 
        pcr->irq = pcr->pci->irq;
-       pci_intx_unmanaged(pcr->pci, !pcr->msi_en);
+       pci_intx(pcr->pci, !pcr->msi_en);
 
        return 0;
 }
 
                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);
 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)
                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);
 
        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();
 
 
                }
        }
 
-       pci_intx_unmanaged(bnad->pcidev, 0);
+       pci_intx(bnad->pcidev, 0);
 
        return;
 
 
 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);
                if (pci_dev_msi_enabled(pdev))
                        pci_disable_msi(pdev);
                else
-                       pci_intx_unmanaged(pdev, 0);
+                       pci_intx(pdev, 0);
        }
 }
 
 
 
        /* 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);
 
        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)
                return -ENOMEM;
 
        res->orig_intx = !enable;
-       pci_intx_unmanaged(pdev, enable);
+       pci_intx(pdev, enable);
 
        return 0;
 }
 
                         */
                        if (affd)
                                irq_create_affinity_masks(1, affd);
-                       pci_intx_unmanaged(dev, 1);
+                       pci_intx(dev, 1);
                        return 1;
                }
        }
 
 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)
 
 }
 
 /**
- * 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;
 
 
        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);
 
 /**
 
                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);
        }
 
         */
        if (unlikely(!is_intx(vdev))) {
                if (vdev->pci_2_3)
-                       pci_intx_unmanaged(pdev, 0);
+                       pci_intx(pdev, 0);
                goto out_unlock;
        }
 
                 * 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);
 
         */
        if (unlikely(!is_intx(vdev))) {
                if (vdev->pci_2_3)
-                       pci_intx_unmanaged(pdev, 1);
+                       pci_intx(pdev, 1);
                goto out_unlock;
        }
 
         */
        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;
         * 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;
 }
 
 
        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;
 
 
 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);