diff options
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/msi.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index e6c80ac07697..073b518338a3 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c | |||
@@ -71,11 +71,13 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs) | |||
71 | } while (rtas_busy_delay(rc)); | 71 | } while (rtas_busy_delay(rc)); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * If the RTAS call succeeded, check the number of irqs is actually | 74 | * If the RTAS call succeeded, return the number of irqs allocated. |
75 | * what we asked for. If not, return an error. | 75 | * If not, make sure we return a negative error code. |
76 | */ | 76 | */ |
77 | if (rc == 0 && rtas_ret[0] != num_irqs) | 77 | if (rc == 0) |
78 | rc = -ENOSPC; | 78 | rc = rtas_ret[0]; |
79 | else if (rc > 0) | ||
80 | rc = -rc; | ||
79 | 81 | ||
80 | pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d), got %d rc = %d\n", | 82 | pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d), got %d rc = %d\n", |
81 | func, num_irqs, rtas_ret[0], rc); | 83 | func, num_irqs, rtas_ret[0], rc); |
@@ -91,7 +93,7 @@ static void rtas_disable_msi(struct pci_dev *pdev) | |||
91 | if (!pdn) | 93 | if (!pdn) |
92 | return; | 94 | return; |
93 | 95 | ||
94 | if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0)) | 96 | if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0) != 0) |
95 | pr_debug("rtas_msi: Setting MSIs to 0 failed!\n"); | 97 | pr_debug("rtas_msi: Setting MSIs to 0 failed!\n"); |
96 | } | 98 | } |
97 | 99 | ||
@@ -195,14 +197,14 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
195 | if (type == PCI_CAP_ID_MSI) { | 197 | if (type == PCI_CAP_ID_MSI) { |
196 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); | 198 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); |
197 | 199 | ||
198 | if (rc) { | 200 | if (rc < 0) { |
199 | pr_debug("rtas_msi: trying the old firmware call.\n"); | 201 | pr_debug("rtas_msi: trying the old firmware call.\n"); |
200 | rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); | 202 | rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); |
201 | } | 203 | } |
202 | } else | 204 | } else |
203 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); | 205 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); |
204 | 206 | ||
205 | if (rc) { | 207 | if (rc != nvec) { |
206 | pr_debug("rtas_msi: rtas_change_msi() failed\n"); | 208 | pr_debug("rtas_msi: rtas_change_msi() failed\n"); |
207 | return rc; | 209 | return rc; |
208 | } | 210 | } |