diff options
Diffstat (limited to 'drivers/pci/msi.c')
| -rw-r--r-- | drivers/pci/msi.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7a1c8a09efa5..4c0b47867258 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
| @@ -1168,7 +1168,8 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, | |||
| 1168 | const struct irq_affinity *affd) | 1168 | const struct irq_affinity *affd) |
| 1169 | { | 1169 | { |
| 1170 | static const struct irq_affinity msi_default_affd; | 1170 | static const struct irq_affinity msi_default_affd; |
| 1171 | int vecs = -ENOSPC; | 1171 | int msix_vecs = -ENOSPC; |
| 1172 | int msi_vecs = -ENOSPC; | ||
| 1172 | 1173 | ||
| 1173 | if (flags & PCI_IRQ_AFFINITY) { | 1174 | if (flags & PCI_IRQ_AFFINITY) { |
| 1174 | if (!affd) | 1175 | if (!affd) |
| @@ -1179,16 +1180,17 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, | |||
| 1179 | } | 1180 | } |
| 1180 | 1181 | ||
| 1181 | if (flags & PCI_IRQ_MSIX) { | 1182 | if (flags & PCI_IRQ_MSIX) { |
| 1182 | vecs = __pci_enable_msix_range(dev, NULL, min_vecs, max_vecs, | 1183 | msix_vecs = __pci_enable_msix_range(dev, NULL, min_vecs, |
| 1183 | affd); | 1184 | max_vecs, affd); |
| 1184 | if (vecs > 0) | 1185 | if (msix_vecs > 0) |
| 1185 | return vecs; | 1186 | return msix_vecs; |
| 1186 | } | 1187 | } |
| 1187 | 1188 | ||
| 1188 | if (flags & PCI_IRQ_MSI) { | 1189 | if (flags & PCI_IRQ_MSI) { |
| 1189 | vecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, affd); | 1190 | msi_vecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, |
| 1190 | if (vecs > 0) | 1191 | affd); |
| 1191 | return vecs; | 1192 | if (msi_vecs > 0) |
| 1193 | return msi_vecs; | ||
| 1192 | } | 1194 | } |
| 1193 | 1195 | ||
| 1194 | /* use legacy irq if allowed */ | 1196 | /* use legacy irq if allowed */ |
| @@ -1199,7 +1201,9 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, | |||
| 1199 | } | 1201 | } |
| 1200 | } | 1202 | } |
| 1201 | 1203 | ||
| 1202 | return vecs; | 1204 | if (msix_vecs == -ENOSPC) |
| 1205 | return -ENOSPC; | ||
| 1206 | return msi_vecs; | ||
| 1203 | } | 1207 | } |
| 1204 | EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity); | 1208 | EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity); |
| 1205 | 1209 | ||
