vserver 2.0 rc7
[linux-2.6.git] / drivers / pci / hotplug / ibmphp_pci.c
index ee0a384..8122fe7 100644 (file)
@@ -1310,41 +1310,37 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function)
                        /* This is Memory */
                        if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) {
                                /* pfmem */
-                               start_address &= PCI_BASE_ADDRESS_MEM_MASK;
                                debug ("start address of pfmem is %x\n", start_address);
+                               start_address &= PCI_BASE_ADDRESS_MEM_MASK;
 
                                if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) {
                                        err ("cannot find corresponding PFMEM resource to remove\n");
                                        return -EIO;
                                }
-                               if (pfmem)
+                               if (pfmem) {
                                        debug ("pfmem->start = %x\n", pfmem->start);
 
-                               ibmphp_remove_resource (pfmem);
-
-                               if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
-                                       /* takes up another dword */
-                                       count += 1;
+                                       ibmphp_remove_resource(pfmem);
                                }
-
                        } else {
                                /* regular memory */
-                               start_address &= PCI_BASE_ADDRESS_MEM_MASK;
                                debug ("start address of mem is %x\n", start_address);
+                               start_address &= PCI_BASE_ADDRESS_MEM_MASK;
+
                                if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) {
                                        err ("cannot find corresponding MEM resource to remove\n");
                                        return -EIO;
                                }
-                               if (mem)
+                               if (mem) {
                                        debug ("mem->start = %x\n", mem->start);
 
-                               ibmphp_remove_resource (mem);
-
-                               if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
-                                       /* takes up another dword */
-                                       count += 1;
+                                       ibmphp_remove_resource(mem);
                                }
                        }
+                       if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+                               /* takes up another dword */
+                               count += 1;
+                       }
                }       /* end of mem */
        }       /* end of for */
 
@@ -1384,9 +1380,6 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function)
                return -EINVAL;
        }
 
-       pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number);
-       sec_no = (int) sec_no;
-
        pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sub_number);
        sub_no = (int) sub_number;
        debug ("sub_no is %d, sec_no is %d\n", sub_no, sec_no);
@@ -1438,16 +1431,11 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function)
                                        err ("cannot find corresponding PFMEM resource to remove\n");
                                        return -EINVAL;
                                }
-                               if (pfmem)
+                               if (pfmem) {
                                        debug ("pfmem->start = %x\n", pfmem->start);
 
-                               ibmphp_remove_resource (pfmem);
-
-                               if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
-                                       /* takes up another dword */
-                                       count += 1;
+                                       ibmphp_remove_resource(pfmem);
                                }
-
                        } else {
                                /* regular memory */
                                start_address &= PCI_BASE_ADDRESS_MEM_MASK;
@@ -1455,16 +1443,16 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function)
                                        err ("cannot find corresponding MEM resource to remove\n");
                                        return -EINVAL;
                                }
-                               if (mem)
+                               if (mem) {
                                        debug ("mem->start = %x\n", mem->start);
 
-                               ibmphp_remove_resource (mem);
-
-                               if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
-                                       /* takes up another dword */
-                                       count += 1;
+                                       ibmphp_remove_resource(mem);
                                }
                        }
+                       if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+                               /* takes up another dword */
+                               count += 1;
+                       }
                }       /* end of mem */
        }       /* end of for */
        debug ("%s - exiting, returning success\n", __FUNCTION__);