ChangeSet 1.2181.16.9, 2005/03/17 13:54:33-08:00, [EMAIL PROTECTED]
[PATCH] PCI Hotplug: remove code duplication in
drivers/pci/hotplug/ibmphp_pci.c
This patch removes some code duplication where if and else have the
same code at the beginning and the end of the branch.
Signed-off-by: Rolf Eike Beer <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
ibmphp_pci.c | 36 ++++++++++--------------------------
1 files changed, 10 insertions(+), 26 deletions(-)
diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c 2005-04-03 21:08:24 -07:00
+++ b/drivers/pci/hotplug/ibmphp_pci.c 2005-04-03 21:08:24 -07:00
@@ -1308,9 +1308,9 @@
/* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI
CONFIG SPACE BACK ?????????? */
} else {
/* This is Memory */
+ start_address &= PCI_BASE_ADDRESS_MEM_MASK;
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);
if (ibmphp_find_resource (bus, start_address,
&pfmem, PFMEM) < 0) {
@@ -1321,15 +1321,8 @@
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;
- }
-
} else {
/* regular memory */
- start_address &= PCI_BASE_ADDRESS_MEM_MASK;
debug ("start address of mem is %x\n",
start_address);
if (ibmphp_find_resource (bus, start_address,
&mem, MEM) < 0) {
err ("cannot find corresponding MEM
resource to remove\n");
@@ -1339,11 +1332,10 @@
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;
- }
+ }
+ if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+ /* takes up another dword */
+ count += 1;
}
} /* end of mem */
} /* end of for */
@@ -1428,9 +1420,9 @@
/* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI
CONFIG SPACE BACK ?????????? */
} else {
/* This is Memory */
+ start_address &= PCI_BASE_ADDRESS_MEM_MASK;
if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) {
/* pfmem */
- 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 -EINVAL;
@@ -1439,15 +1431,8 @@
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;
- }
-
} else {
/* regular memory */
- 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 -EINVAL;
@@ -1456,11 +1441,10 @@
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;
- }
+ }
+ if (tmp_address & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+ /* takes up another dword */
+ count += 1;
}
} /* end of mem */
} /* end of for */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html