]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/powernv: Simplify pnv_eeh_set_option()
authorGavin Shan <gwshan@linux.vnet.ibm.com>
Thu, 8 Oct 2015 03:58:59 +0000 (14:58 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 21 Oct 2015 09:42:15 +0000 (20:42 +1100)
This simplifies pnv_eeh_set_option() to avoid unnecessary nested
if statements, to improve readability. No functional changes.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/eeh-powernv.c

index 2b5c70b54814f8d0902a2352e3d2284f9b6470a0..d62007f94372d385062adbae9b2921e4f376da0e 100644 (file)
@@ -471,7 +471,7 @@ static int pnv_eeh_set_option(struct eeh_pe *pe, int option)
        struct pci_controller *hose = pe->phb;
        struct pnv_phb *phb = hose->private_data;
        bool freeze_pe = false;
-       int opt, ret = 0;
+       int opt;
        s64 rc;
 
        switch (option) {
@@ -494,38 +494,37 @@ static int pnv_eeh_set_option(struct eeh_pe *pe, int option)
                return -EINVAL;
        }
 
-       /* If PHB supports compound PE, to handle it */
+       /* Freeze master and slave PEs if PHB supports compound PEs */
        if (freeze_pe) {
                if (phb->freeze_pe) {
                        phb->freeze_pe(phb, pe->addr);
-               } else {
-                       rc = opal_pci_eeh_freeze_set(phb->opal_id,
-                                                    pe->addr, opt);
-                       if (rc != OPAL_SUCCESS) {
-                               pr_warn("%s: Failure %lld freezing "
-                                       "PHB#%x-PE#%x\n",
-                                       __func__, rc,
-                                       phb->hose->global_number, pe->addr);
-                               ret = -EIO;
-                       }
+                       return 0;
                }
-       } else {
-               if (phb->unfreeze_pe) {
-                       ret = phb->unfreeze_pe(phb, pe->addr, opt);
-               } else {
-                       rc = opal_pci_eeh_freeze_clear(phb->opal_id,
-                                                      pe->addr, opt);
-                       if (rc != OPAL_SUCCESS) {
-                               pr_warn("%s: Failure %lld enable %d "
-                                       "for PHB#%x-PE#%x\n",
-                                       __func__, rc, option,
-                                       phb->hose->global_number, pe->addr);
-                               ret = -EIO;
-                       }
+
+               rc = opal_pci_eeh_freeze_set(phb->opal_id, pe->addr, opt);
+               if (rc != OPAL_SUCCESS) {
+                       pr_warn("%s: Failure %lld freezing PHB#%x-PE#%x\n",
+                               __func__, rc, phb->hose->global_number,
+                               pe->addr);
+                       return -EIO;
                }
+
+               return 0;
        }
 
-       return ret;
+       /* Unfreeze master and slave PEs if PHB supports */
+       if (phb->unfreeze_pe)
+               return phb->unfreeze_pe(phb, pe->addr, opt);
+
+       rc = opal_pci_eeh_freeze_clear(phb->opal_id, pe->addr, opt);
+       if (rc != OPAL_SUCCESS) {
+               pr_warn("%s: Failure %lld enable %d for PHB#%x-PE#%x\n",
+                       __func__, rc, option, phb->hose->global_number,
+                       pe->addr);
+               return -EIO;
+       }
+
+       return 0;
 }
 
 /**