aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 823c3861c4d8..2837285c4e83 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -32,16 +32,39 @@ static int pci_msi_enable = 1;
32 32
33int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) 33int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
34{ 34{
35 return -EINVAL; 35 struct msi_chip *chip = dev->bus->msi;
36 int err;
37
38 if (!chip || !chip->setup_irq)
39 return -EINVAL;
40
41 err = chip->setup_irq(chip, dev, desc);
42 if (err < 0)
43 return err;
44
45 irq_set_chip_data(desc->irq, chip);
46
47 return 0;
36} 48}
37 49
38void __weak arch_teardown_msi_irq(unsigned int irq) 50void __weak arch_teardown_msi_irq(unsigned int irq)
39{ 51{
52 struct msi_chip *chip = irq_get_chip_data(irq);
53
54 if (!chip || !chip->teardown_irq)
55 return;
56
57 chip->teardown_irq(chip, irq);
40} 58}
41 59
42int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type) 60int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
43{ 61{
44 return 0; 62 struct msi_chip *chip = dev->bus->msi;
63
64 if (!chip || !chip->check_device)
65 return 0;
66
67 return chip->check_device(chip, dev, nvec, type);
45} 68}
46 69
47int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 70int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)