Skip to content

Commit ed02010

Browse files
Philipp Stannergregkh
authored andcommitted
PCI: Remove devres from pci_intx()
[ Upstream commit dfa2f4d ] 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: d555ed4 ("PCI: Restore original INTX_DISABLE bit by pcim_intx()") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 969c54c commit ed02010

File tree

3 files changed

+4
-44
lines changed

3 files changed

+4
-44
lines changed

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/pci.c

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

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

@@ -4507,41 +4503,6 @@ void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
45074503

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

45474508
/**

include/linux/pci.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,6 @@ int __must_check pcim_set_mwi(struct pci_dev *dev);
13531353
int pci_try_set_mwi(struct pci_dev *dev);
13541354
void pci_clear_mwi(struct pci_dev *dev);
13551355
void pci_disable_parity(struct pci_dev *dev);
1356-
void pci_intx_unmanaged(struct pci_dev *pdev, int enable);
13571356
void pci_intx(struct pci_dev *dev, int enable);
13581357
bool pci_check_and_mask_intx(struct pci_dev *dev);
13591358
bool pci_check_and_unmask_intx(struct pci_dev *dev);

0 commit comments

Comments
 (0)