lkml.org 
[lkml]   [2004]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] PCI Update for 2.6.3-rc1
Date
From
ChangeSet 1.1500.11.15, 2004/02/03 16:49:40-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: kill hpcrc from several functions in ibmphp_core.c

This patch kills the variable hpcrc from many places. It is used as a
temporary storage for the return code before this is copied to rc which
contains the "real" return code. There are some checks if to copy or not
but at the end they will always have the same value, so we can directly
put the return code in rc and kill hpcrc.


drivers/pci/hotplug/ibmphp_core.c | 93 +++++++++++---------------------------
1 files changed, 27 insertions(+), 66 deletions(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c Mon Feb 9 14:58:47 2004
+++ b/drivers/pci/hotplug/ibmphp_core.c Mon Feb 9 14:58:47 2004
@@ -104,7 +104,7 @@
if (rc)
return rc;
if (!init_flag)
- return get_cur_bus_info (sl);
+ rc = get_cur_bus_info(sl);
return rc;
}

@@ -208,7 +208,7 @@
err ("command not completed successfully in power_off\n");
retval = -EIO;
}
- return 0;
+ return retval;
}

static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 value)
@@ -216,7 +216,6 @@
int rc = 0;
struct slot *pslot;
u8 cmd;
- int hpcrc = 0;

debug ("set_attention_status - Entry hotplug_slot[%lx] value[%x]\n", (ulong) hotplug_slot, value);
ibmphp_lock_operations ();
@@ -241,16 +240,13 @@
if (rc == 0) {
pslot = (struct slot *) hotplug_slot->private;
if (pslot)
- hpcrc = ibmphp_hpc_writeslot (pslot, cmd);
+ rc = ibmphp_hpc_writeslot(pslot, cmd);
else
rc = -ENODEV;
}
} else
rc = -ENODEV;

- if (hpcrc)
- rc = hpcrc;
-
ibmphp_unlock_operations ();

debug ("set_attention_status - Exit rc[%d]\n", rc);
@@ -261,7 +257,6 @@
{
int rc = -ENODEV;
struct slot *pslot;
- int hpcrc = 0;
struct slot myslot;

debug ("get_attention_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -271,22 +266,16 @@
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
- if (!hpcrc)
- hpcrc = ibmphp_hpc_readslot (pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
- if (!hpcrc) {
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ if (!rc)
+ rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
+ if (!rc)
*value = SLOT_ATTN (myslot.status, myslot.ext_status);
- rc = 0;
- }
}
- } else
- rc = -ENODEV;
-
- if (hpcrc)
- rc = hpcrc;
+ }

ibmphp_unlock_operations ();
- debug ("get_attention_status - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+ debug("get_attention_status - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}

@@ -294,7 +283,6 @@
{
int rc = -ENODEV;
struct slot *pslot;
- int hpcrc = 0;
struct slot myslot;

debug ("get_latch_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -303,20 +291,14 @@
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
- if (!hpcrc) {
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ if (!rc)
*value = SLOT_LATCH (myslot.status);
- rc = 0;
- }
}
- } else
- rc = -ENODEV;
-
- if (hpcrc)
- rc = hpcrc;
+ }

ibmphp_unlock_operations ();
- debug ("get_latch_status - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+ debug("get_latch_status - Exit rc[%d] rc[%x] value[%x]\n", rc, rc, *value);
return rc;
}

@@ -325,7 +307,6 @@
{
int rc = -ENODEV;
struct slot *pslot;
- int hpcrc = 0;
struct slot myslot;

debug ("get_power_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -334,20 +315,14 @@
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
- if (!hpcrc) {
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ if (!rc)
*value = SLOT_PWRGD (myslot.status);
- rc = 0;
- }
}
- } else
- rc = -ENODEV;
-
- if (hpcrc)
- rc = hpcrc;
+ }

ibmphp_unlock_operations ();
- debug ("get_power_status - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+ debug("get_power_status - Exit rc[%d] rc[%x] value[%x]\n", rc, rc, *value);
return rc;
}

@@ -356,7 +331,6 @@
int rc = -ENODEV;
struct slot *pslot;
u8 present;
- int hpcrc = 0;
struct slot myslot;

debug ("get_adapter_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -365,23 +339,19 @@
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
- if (!hpcrc) {
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+ if (!rc) {
present = SLOT_PRESENT (myslot.status);
if (present == HPC_SLOT_EMPTY)
*value = 0;
else
*value = 1;
- rc = 0;
}
}
- } else
- rc = -ENODEV;
- if (hpcrc)
- rc = hpcrc;
+ }

ibmphp_unlock_operations ();
- debug ("get_adapter_present - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+ debug("get_adapter_present - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}

@@ -475,7 +445,6 @@
{
int rc = -ENODEV;
struct slot *pslot;
- int hpcrc = 0;
struct slot myslot;

debug ("get_max_adapter_speed_1 - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong)hotplug_slot, (ulong) value);
@@ -487,29 +456,21 @@
pslot = (struct slot *) hotplug_slot->private;
if (pslot) {
memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
- hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
+ rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));

if (!(SLOT_LATCH (myslot.status)) && (SLOT_PRESENT (myslot.status))) {
- hpcrc = ibmphp_hpc_readslot (pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
- if (!hpcrc) {
+ rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
+ if (!rc)
*value = SLOT_SPEED (myslot.ext_status);
- rc = 0;
- }
- } else {
+ } else
*value = MAX_ADAPTER_NONE;
- rc = 0;
- }
}
- } else
- rc = -ENODEV;
-
- if (hpcrc)
- rc = hpcrc;
+ }

if (flag)
ibmphp_unlock_operations ();

- debug ("get_max_adapter_speed_1 - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+ debug("get_max_adapter_speed_1 - Exit rc[%d] value[%x]\n", rc, *value);
return rc;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:00    [W:0.127 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site