powerpc/eeh: Slightly simplify eeh_add_to_parent_pe()
authorSam Bobroff <sbobroff@linux.ibm.com>
Fri, 16 Aug 2019 04:48:16 +0000 (14:48 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Aug 2019 13:12:47 +0000 (23:12 +1000)
Simplify some needlessly complicated boolean logic in
eeh_add_to_parent_pe().

Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/09259a50308f10aa764695912bc87dc1d1cf654c.1565930772.git.sbobroff@linux.ibm.com
arch/powerpc/kernel/eeh_pe.c

index 9c38fa7c33aa169a5f70571b0c5d4754f5e48a4d..1a6254bcf056e42690bb3c25573f891a2b261235 100644 (file)
@@ -383,32 +383,34 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
         * components.
         */
        pe = eeh_pe_get(pdn->phb, edev->pe_config_addr, config_addr);
-       if (pe && !(pe->type & EEH_PE_INVALID)) {
-               /* Mark the PE as type of PCI bus */
-               pe->type = EEH_PE_BUS;
-               edev->pe = pe;
-
-               /* Put the edev to PE */
-               list_add_tail(&edev->entry, &pe->edevs);
-               eeh_edev_dbg(edev, "Added to bus PE\n");
-               return 0;
-       } else if (pe && (pe->type & EEH_PE_INVALID)) {
-               list_add_tail(&edev->entry, &pe->edevs);
-               edev->pe = pe;
-               /*
-                * We're running to here because of PCI hotplug caused by
-                * EEH recovery. We need clear EEH_PE_INVALID until the top.
-                */
-               parent = pe;
-               while (parent) {
-                       if (!(parent->type & EEH_PE_INVALID))
-                               break;
-                       parent->type &= ~EEH_PE_INVALID;
-                       parent = parent->parent;
-               }
+       if (pe) {
+               if (pe->type & EEH_PE_INVALID) {
+                       list_add_tail(&edev->entry, &pe->edevs);
+                       edev->pe = pe;
+                       /*
+                        * We're running to here because of PCI hotplug caused by
+                        * EEH recovery. We need clear EEH_PE_INVALID until the top.
+                        */
+                       parent = pe;
+                       while (parent) {
+                               if (!(parent->type & EEH_PE_INVALID))
+                                       break;
+                               parent->type &= ~EEH_PE_INVALID;
+                               parent = parent->parent;
+                       }
 
-               eeh_edev_dbg(edev, "Added to device PE (parent: PE#%x)\n",
-                            pe->parent->addr);
+                       eeh_edev_dbg(edev,
+                                    "Added to device PE (parent: PE#%x)\n",
+                                    pe->parent->addr);
+               } else {
+                       /* Mark the PE as type of PCI bus */
+                       pe->type = EEH_PE_BUS;
+                       edev->pe = pe;
+
+                       /* Put the edev to PE */
+                       list_add_tail(&edev->entry, &pe->edevs);
+                       eeh_edev_dbg(edev, "Added to bus PE\n");
+               }
                return 0;
        }