Skip to content

Commit dfa2f4d

Browse files
Philipp Stannerbjorn-helgaas
authored andcommitted
PCI: Remove devres from pci_intx()
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/[email protected] Signed-off-by: Philipp Stanner <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Paolo Abeni <[email protected]>
1 parent 41400bc commit dfa2f4d

File tree

14 files changed

+22
-62
lines changed

14 files changed

+22
-62
lines changed

drivers/misc/cardreader/rtsx_pcr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ static int rtsx_pci_acquire_irq(struct rtsx_pcr *pcr)
10571057
}
10581058

10591059
pcr->irq = pcr->pci->irq;
1060-
pci_intx_unmanaged(pcr->pci, !pcr->msi_en);
1060+
pci_intx(pcr->pci, !pcr->msi_en);
10611061

10621062
return 0;
10631063
}

drivers/misc/tifm_7xx1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
327327
goto err_out;
328328
}
329329

330-
pci_intx_unmanaged(dev, 1);
330+
pci_intx(dev, 1);
331331

332332
fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
333333
? 4 : 2, &dev->dev);
@@ -368,7 +368,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
368368
err_out_free:
369369
tifm_free_adapter(fm);
370370
err_out_int:
371-
pci_intx_unmanaged(dev, 0);
371+
pci_intx(dev, 0);
372372
pci_release_regions(dev);
373373
err_out:
374374
if (!pci_dev_busy)
@@ -392,7 +392,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev)
392392
tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt));
393393

394394
iounmap(fm->addr);
395-
pci_intx_unmanaged(dev, 0);
395+
pci_intx(dev, 0);
396396
pci_release_regions(dev);
397397

398398
pci_disable_device(dev);

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp)
16691669
REG_WR(bp, IGU_REG_PF_CONFIGURATION, val);
16701670

16711671
if (val & IGU_PF_CONF_INT_LINE_EN)
1672-
pci_intx_unmanaged(bp->pdev, true);
1672+
pci_intx(bp->pdev, true);
16731673

16741674
barrier();
16751675

drivers/net/ethernet/brocade/bna/bnad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ bnad_enable_msix(struct bnad *bnad)
26692669
}
26702670
}
26712671

2672-
pci_intx_unmanaged(bnad->pcidev, 0);
2672+
pci_intx(bnad->pcidev, 0);
26732673

26742674
return;
26752675

drivers/ntb/hw/amd/ntb_hw_amd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
791791
err_msi_enable:
792792

793793
/* Try to set up intx irq */
794-
pci_intx_unmanaged(pdev, 1);
794+
pci_intx(pdev, 1);
795795

796796
rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
797797
"ndev_irq_isr", ndev);
@@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev)
831831
if (pci_dev_msi_enabled(pdev))
832832
pci_disable_msi(pdev);
833833
else
834-
pci_intx_unmanaged(pdev, 0);
834+
pci_intx(pdev, 0);
835835
}
836836
}
837837

drivers/ntb/hw/intel/ntb_hw_gen1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev,
445445

446446
/* Try to set up intx irq */
447447

448-
pci_intx_unmanaged(pdev, 1);
448+
pci_intx(pdev, 1);
449449

450450
rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
451451
"ndev_irq_isr", ndev);

drivers/pci/devres.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ static void pcim_intx_restore(struct device *dev, void *data)
416416
struct pci_dev *pdev = to_pci_dev(dev);
417417
struct pcim_intx_devres *res = data;
418418

419-
pci_intx_unmanaged(pdev, res->orig_intx);
419+
pci_intx(pdev, res->orig_intx);
420420
}
421421

422422
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)
453453
return -ENOMEM;
454454

455455
res->orig_intx = !enable;
456-
pci_intx_unmanaged(pdev, enable);
456+
pci_intx(pdev, enable);
457457

458458
return 0;
459459
}

drivers/pci/msi/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
289289
*/
290290
if (affd)
291291
irq_create_affinity_masks(1, affd);
292-
pci_intx_unmanaged(dev, 1);
292+
pci_intx(dev, 1);
293293
return 1;
294294
}
295295
}

drivers/pci/msi/msi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(pci_write_msi_msg);
268268
static void pci_intx_for_msi(struct pci_dev *dev, int enable)
269269
{
270270
if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
271-
pci_intx_unmanaged(dev, enable);
271+
pci_intx(dev, enable);
272272
}
273273

274274
static void pci_msi_set_enable(struct pci_dev *dev, int enable)

drivers/pci/pci.c

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4480,17 +4480,13 @@ void pci_disable_parity(struct pci_dev *dev)
44804480
}
44814481

44824482
/**
4483-
* pci_intx_unmanaged - enables/disables PCI INTx for device dev,
4484-
* unmanaged version
4483+
* pci_intx - enables/disables PCI INTx for device dev
44854484
* @pdev: the PCI device to operate on
44864485
* @enable: boolean: whether to enable or disable PCI INTx
44874486
*
44884487
* Enables/disables PCI INTx for device @pdev
4489-
*
4490-
* This function behavios identically to pci_intx(), but is never managed with
4491-
* devres.
44924488
*/
4493-
void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
4489+
void pci_intx(struct pci_dev *pdev, int enable)
44944490
{
44954491
u16 pci_command, new;
44964492

@@ -4506,41 +4502,6 @@ void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
45064502

45074503
pci_write_config_word(pdev, PCI_COMMAND, new);
45084504
}
4509-
EXPORT_SYMBOL_GPL(pci_intx_unmanaged);
4510-
4511-
/**
4512-
* pci_intx - enables/disables PCI INTx for device dev
4513-
* @pdev: the PCI device to operate on
4514-
* @enable: boolean: whether to enable or disable PCI INTx
4515-
*
4516-
* Enables/disables PCI INTx for device @pdev
4517-
*
4518-
* NOTE:
4519-
* This is a "hybrid" function: It's normally unmanaged, but becomes managed
4520-
* when pcim_enable_device() has been called in advance. This hybrid feature is
4521-
* DEPRECATED! If you want managed cleanup, use pcim_intx() instead.
4522-
*/
4523-
void pci_intx(struct pci_dev *pdev, int enable)
4524-
{
4525-
u16 pci_command, new;
4526-
4527-
pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
4528-
4529-
if (enable)
4530-
new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
4531-
else
4532-
new = pci_command | PCI_COMMAND_INTX_DISABLE;
4533-
4534-
if (new != pci_command) {
4535-
/* Preserve the "hybrid" behavior for backwards compatibility */
4536-
if (pci_is_managed(pdev)) {
4537-
WARN_ON_ONCE(pcim_intx(pdev, enable) != 0);
4538-
return;
4539-
}
4540-
4541-
pci_write_config_word(pdev, PCI_COMMAND, new);
4542-
}
4543-
}
45444505
EXPORT_SYMBOL_GPL(pci_intx);
45454506

45464507
/**

0 commit comments

Comments
 (0)