Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d385366a9b96fc3f4705f8513adccceaa0515f97
Commit:     d385366a9b96fc3f4705f8513adccceaa0515f97
Parent:     fcbe8090a001522f98ad6f3146f0a1d9fa473821
Author:     Michael Ellerman <[EMAIL PROTECTED]>
AuthorDate: Thu Sep 20 16:36:50 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Wed Oct 3 09:11:39 2007 +1000

    [POWERPC] Simplify rtas_change_msi() error semantics
    
    Currently rtas_change_msi() returns either the error code from RTAS, or if
    the RTAS call succeeded the number of irqs that were configured by RTAS.
    This makes checking the return value more complicated than it needs to be.
    
    Instead, have rtas_change_msi() check that the number of irqs configured by
    RTAS is equal to what we requested - and return an error otherwise. This 
makes
    the return semantics match the usual 0 for success, something else for 
error.
    
    Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/msi.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c 
b/arch/powerpc/platforms/pseries/msi.c
index 9c3bcfe..2793a1b 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -70,11 +70,15 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, 
u32 num_irqs)
                seq_num = rtas_ret[1];
        } while (rtas_busy_delay(rc));
 
-       if (rc == 0) /* Success */
-               rc = rtas_ret[0];
+       /*
+        * If the RTAS call succeeded, check the number of irqs is actually
+        * what we asked for. If not, return an error.
+        */
+       if (rc == 0 && rtas_ret[0] != num_irqs)
+               rc = -ENOSPC;
 
-       pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d) = (%d)\n",
-                func, num_irqs, rc);
+       pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d), got %d rc = %d\n",
+                func, num_irqs, rtas_ret[0], rc);
 
        return rc;
 }
@@ -87,7 +91,7 @@ static void rtas_disable_msi(struct pci_dev *pdev)
        if (!pdn)
                return;
 
-       if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0) != 0)
+       if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0))
                pr_debug("rtas_msi: Setting MSIs to 0 failed!\n");
 }
 
@@ -180,14 +184,14 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int 
nvec, int type)
        if (type == PCI_CAP_ID_MSI) {
                rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec);
 
-               if (rc != nvec) {
+               if (rc) {
                        pr_debug("rtas_msi: trying the old firmware call.\n");
                        rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec);
                }
        } else
                rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
 
-       if (rc != nvec) {
+       if (rc) {
                pr_debug("rtas_msi: rtas_change_msi() failed\n");
                return rc;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to