Skip to content

Commit 262a2ba

Browse files
YijingWangbjorn-helgaas
authored andcommitted
PCI/MSI: Add weak pcibios_msi_controller()
Add pcibios_msi_controller() to get the msi_controller associated with a PCI device. This is to allow arches to store the msi_controller in the arch-specific PCI sysdata. [bhelgaas: changelog, take pci_dev instead of pci_bus] Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent c2791b8 commit 262a2ba

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎drivers/pci/msi.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,24 @@ int pci_msi_ignore_mask;
3030

3131
/* Arch hooks */
3232

33+
struct msi_controller * __weak pcibios_msi_controller(struct pci_dev *dev)
34+
{
35+
return NULL;
36+
}
37+
38+
static struct msi_controller *pci_msi_controller(struct pci_dev *dev)
39+
{
40+
struct msi_controller *msi_ctrl = dev->bus->msi;
41+
42+
if (msi_ctrl)
43+
return msi_ctrl;
44+
45+
return pcibios_msi_controller(dev);
46+
}
47+
3348
int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
3449
{
35-
struct msi_controller *chip = dev->bus->msi;
50+
struct msi_controller *chip = pci_msi_controller(dev);
3651
int err;
3752

3853
if (!chip || !chip->setup_irq)

0 commit comments

Comments
 (0)