Commit 5ca5c02f authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by Jesse Barnes

PCI/MSI: skip calling pci_find_capability from msi_set_mask_bits

The position of MSI capability is already cached in the msi_desc when
we enter the msi_set_mask_bits().  Use it instead.
Signed-off-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent cf35e4ad
...@@ -70,12 +70,10 @@ arch_teardown_msi_irqs(struct pci_dev *dev) ...@@ -70,12 +70,10 @@ arch_teardown_msi_irqs(struct pci_dev *dev)
} }
} }
static void msi_set_enable(struct pci_dev *dev, int enable) static void __msi_set_enable(struct pci_dev *dev, int pos, int enable)
{ {
int pos;
u16 control; u16 control;
pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
if (pos) { if (pos) {
pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
control &= ~PCI_MSI_FLAGS_ENABLE; control &= ~PCI_MSI_FLAGS_ENABLE;
...@@ -85,6 +83,11 @@ static void msi_set_enable(struct pci_dev *dev, int enable) ...@@ -85,6 +83,11 @@ static void msi_set_enable(struct pci_dev *dev, int enable)
} }
} }
static void msi_set_enable(struct pci_dev *dev, int enable)
{
__msi_set_enable(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), enable);
}
static void msix_set_enable(struct pci_dev *dev, int enable) static void msix_set_enable(struct pci_dev *dev, int enable)
{ {
int pos; int pos;
...@@ -141,7 +144,8 @@ static void msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag) ...@@ -141,7 +144,8 @@ static void msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag)
mask_bits |= flag & mask; mask_bits |= flag & mask;
pci_write_config_dword(entry->dev, pos, mask_bits); pci_write_config_dword(entry->dev, pos, mask_bits);
} else { } else {
msi_set_enable(entry->dev, !flag); __msi_set_enable(entry->dev, entry->msi_attrib.pos,
!flag);
} }
break; break;
case PCI_CAP_ID_MSIX: case PCI_CAP_ID_MSIX:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment