Commit eac93d60 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] IBM PCI Hotplug: get rid of unneeded ops structure and surrounding logic.

parent a7f43eff
...@@ -683,11 +683,6 @@ extern void ibmphp_hpc_stop_poll_thread (void); ...@@ -683,11 +683,6 @@ extern void ibmphp_hpc_stop_poll_thread (void);
#define ENABLE 1 #define ENABLE 1
#define DISABLE 0 #define DISABLE 0
#define ADD 0
#define REMOVE 1
#define DETAIL 2
#define MAX_OPS 3
#define CARD_INFO 0x07 #define CARD_INFO 0x07
#define PCIX133 0x07 #define PCIX133 0x07
#define PCIX66 0x05 #define PCIX66 0x05
......
...@@ -55,7 +55,6 @@ MODULE_PARM_DESC (debug, "Debugging mode enabled or not"); ...@@ -55,7 +55,6 @@ MODULE_PARM_DESC (debug, "Debugging mode enabled or not");
MODULE_LICENSE ("GPL"); MODULE_LICENSE ("GPL");
MODULE_DESCRIPTION (DRIVER_DESC); MODULE_DESCRIPTION (DRIVER_DESC);
static int *ops[MAX_OPS + 1];
struct pci_bus *ibmphp_pci_bus; struct pci_bus *ibmphp_pci_bus;
static int max_slots; static int max_slots;
...@@ -550,20 +549,6 @@ static int __init init_ops (void) ...@@ -550,20 +549,6 @@ static int __init init_ops (void)
struct list_head *tmp; struct list_head *tmp;
int retval; int retval;
int rc; int rc;
int j;
for (j = 0; j < MAX_OPS; j++) {
ops[j] = (int *) kmalloc ((max_slots + 1) * sizeof (int), GFP_KERNEL);
memset (ops[j], 0, (max_slots + 1) * sizeof (int));
if (!ops[j]) {
err ("out of system memory \n");
return -ENOMEM;
}
}
ops[ADD][0] = 0;
ops[REMOVE][0] = 0;
ops[DETAIL][0] = 0;
list_for_each (tmp, &ibmphp_slot_head) { list_for_each (tmp, &ibmphp_slot_head) {
slot_cur = list_entry (tmp, struct slot, ibm_slot_list); slot_cur = list_entry (tmp, struct slot, ibm_slot_list);
...@@ -588,24 +573,15 @@ static int __init init_ops (void) ...@@ -588,24 +573,15 @@ static int __init init_ops (void)
if (retval) if (retval)
return retval; return retval;
debug ("status = %x, ext_status = %x\n", slot_cur->status, slot_cur->ext_status); debug ("status = %x\n", slot_cur->status);
debug ("SLOT_POWER = %x, SLOT_PRESENT = %x, SLOT_LATCH = %x\n", SLOT_POWER (slot_cur->status), SLOT_PRESENT (slot_cur->status), SLOT_LATCH (slot_cur->status)); debug ("ext_status = %x\n", slot_cur->ext_status);
debug ("SLOT_POWER = %x\n", SLOT_POWER (slot_cur->status));
debug ("SLOT_PRESENT = %x\n", SLOT_PRESENT (slot_cur->status));
debug ("SLOT_LATCH = %x\n", SLOT_LATCH (slot_cur->status));
if (!(SLOT_PWRGD (slot_cur->status)) && (SLOT_PRESENT (slot_cur->status)) && !(SLOT_LATCH (slot_cur->status))) if ((SLOT_PWRGD (slot_cur->status)) &&
/* No power, adapter, and latch closed */ !(SLOT_PRESENT (slot_cur->status)) &&
ops[ADD][slot_cur->number] = 1; !(SLOT_LATCH (slot_cur->status))) {
else
ops[ADD][slot_cur->number] = 0;
ops[DETAIL][slot_cur->number] = 1;
if ((SLOT_PWRGD (slot_cur->status)) && (SLOT_PRESENT (slot_cur->status)) && !(SLOT_LATCH (slot_cur->status)))
/*Power,adapter,latch closed */
ops[REMOVE][slot_cur->number] = 1;
else
ops[REMOVE][slot_cur->number] = 0;
if ((SLOT_PWRGD (slot_cur->status)) && !(SLOT_PRESENT (slot_cur->status)) && !(SLOT_LATCH (slot_cur->status))) {
debug ("BEFORE POWER OFF COMMAND\n"); debug ("BEFORE POWER OFF COMMAND\n");
rc = power_off (slot_cur); rc = power_off (slot_cur);
if (rc) if (rc)
...@@ -643,35 +619,20 @@ static int validate (struct slot *slot_cur, int opn) ...@@ -643,35 +619,20 @@ static int validate (struct slot *slot_cur, int opn)
if (retval) if (retval)
return retval; return retval;
if (!(SLOT_PWRGD (slot_cur->status)) && (SLOT_PRESENT (slot_cur->status))
&& !(SLOT_LATCH (slot_cur->status)))
ops[ADD][number] = 1;
else
ops[ADD][number] = 0;
ops[DETAIL][number] = 1;
if ((SLOT_PWRGD (slot_cur->status)) && (SLOT_PRESENT (slot_cur->status))
&& !(SLOT_LATCH (slot_cur->status)))
ops[REMOVE][number] = 1;
else
ops[REMOVE][number] = 0;
switch (opn) { switch (opn) {
case ENABLE: case ENABLE:
if (ops[ADD][number]) if (!(SLOT_PWRGD (slot_cur->status)) &&
(SLOT_PRESENT (slot_cur->status)) &&
!(SLOT_LATCH (slot_cur->status)))
return 0; return 0;
break; break;
case DISABLE: case DISABLE:
if (ops[REMOVE][number]) if ((SLOT_PWRGD (slot_cur->status)) &&
return 0; (SLOT_PRESENT (slot_cur->status)) &&
break; !(SLOT_LATCH (slot_cur->status)))
case DETAIL:
if (ops[DETAIL][number])
return 0; return 0;
break; break;
default: default:
return -EINVAL;
break; break;
} }
err ("validate failed....\n"); err ("validate failed....\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment