Commit 1d3ecf13 authored by Alex Chiang's avatar Alex Chiang Committed by Jesse Barnes

PCI Hotplug: cpqphp: clean up cpqphp_ctrl.c

Style and whitespace cleanups, no functional change.
Signed-off-by: default avatarAlex Chiang <achiang@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 867556fe
...@@ -132,9 +132,8 @@ static struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device) ...@@ -132,9 +132,8 @@ static struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device)
{ {
struct slot *slot = ctrl->slot; struct slot *slot = ctrl->slot;
while (slot && (slot->device != device)) { while (slot && (slot->device != device))
slot = slot->next; slot = slot->next;
}
return slot; return slot;
} }
...@@ -549,10 +548,10 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size ...@@ -549,10 +548,10 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size
if (!(*head)) if (!(*head))
return NULL; return NULL;
if ( cpqhp_resource_sort_and_combine(head) ) if (cpqhp_resource_sort_and_combine(head))
return NULL; return NULL;
if ( sort_by_size(head) ) if (sort_by_size(head))
return NULL; return NULL;
for (node = *head; node; node = node->next) { for (node = *head; node; node = node->next) {
...@@ -974,12 +973,8 @@ struct pci_func *cpqhp_slot_create(u8 busnumber) ...@@ -974,12 +973,8 @@ struct pci_func *cpqhp_slot_create(u8 busnumber)
struct pci_func *next; struct pci_func *next;
new_slot = kzalloc(sizeof(*new_slot), GFP_KERNEL); new_slot = kzalloc(sizeof(*new_slot), GFP_KERNEL);
if (new_slot == NULL) { if (new_slot == NULL)
/* I'm not dead yet!
* You will be.
*/
return new_slot; return new_slot;
}
new_slot->next = NULL; new_slot->next = NULL;
new_slot->configured = 1; new_slot->configured = 1;
...@@ -1010,10 +1005,8 @@ static int slot_remove(struct pci_func * old_slot) ...@@ -1010,10 +1005,8 @@ static int slot_remove(struct pci_func * old_slot)
return 1; return 1;
next = cpqhp_slot_list[old_slot->bus]; next = cpqhp_slot_list[old_slot->bus];
if (next == NULL)
if (next == NULL) {
return 1; return 1;
}
if (next == old_slot) { if (next == old_slot) {
cpqhp_slot_list[old_slot->bus] = old_slot->next; cpqhp_slot_list[old_slot->bus] = old_slot->next;
...@@ -1022,9 +1015,8 @@ static int slot_remove(struct pci_func * old_slot) ...@@ -1022,9 +1015,8 @@ static int slot_remove(struct pci_func * old_slot)
return 0; return 0;
} }
while ((next->next != old_slot) && (next->next != NULL)) { while ((next->next != old_slot) && (next->next != NULL))
next = next->next; next = next->next;
}
if (next->next == old_slot) { if (next->next == old_slot) {
next->next = old_slot->next; next->next = old_slot->next;
...@@ -1054,10 +1046,9 @@ static int bridge_slot_remove(struct pci_func *bridge) ...@@ -1054,10 +1046,9 @@ static int bridge_slot_remove(struct pci_func *bridge)
for (tempBus = secondaryBus; tempBus <= subordinateBus; tempBus++) { for (tempBus = secondaryBus; tempBus <= subordinateBus; tempBus++) {
next = cpqhp_slot_list[tempBus]; next = cpqhp_slot_list[tempBus];
while (!slot_remove(next)) { while (!slot_remove(next))
next = cpqhp_slot_list[tempBus]; next = cpqhp_slot_list[tempBus];
} }
}
next = cpqhp_slot_list[bridge->bus]; next = cpqhp_slot_list[bridge->bus];
...@@ -1286,17 +1277,17 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) ...@@ -1286,17 +1277,17 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
hp_slot = func->device - ctrl->slot_device_offset; hp_slot = func->device - ctrl->slot_device_offset;
if (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)) {
/* /*
* The switch is open. * The switch is open.
*/ */
if (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot))
rc = INTERLOCK_OPEN; rc = INTERLOCK_OPEN;
} else if (is_slot_enabled (ctrl, hp_slot)) {
/* /*
* The board is already on * The board is already on
*/ */
else if (is_slot_enabled (ctrl, hp_slot))
rc = CARD_FUNCTIONING; rc = CARD_FUNCTIONING;
} else { else {
mutex_lock(&ctrl->crit_sect); mutex_lock(&ctrl->crit_sect);
/* turn on board without attaching to the bus */ /* turn on board without attaching to the bus */
...@@ -1542,7 +1533,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) ...@@ -1542,7 +1533,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
} }
/* All F's is an empty slot or an invalid board */ /* All F's is an empty slot or an invalid board */
if (temp_register != 0xFFFFFFFF) { /* Check for a board in the slot */ if (temp_register != 0xFFFFFFFF) {
res_lists.io_head = ctrl->io_head; res_lists.io_head = ctrl->io_head;
res_lists.mem_head = ctrl->mem_head; res_lists.mem_head = ctrl->mem_head;
res_lists.p_mem_head = ctrl->p_mem_head; res_lists.p_mem_head = ctrl->p_mem_head;
...@@ -1591,9 +1582,8 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) ...@@ -1591,9 +1582,8 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
index = 0; index = 0;
do { do {
new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++); new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++);
if (new_slot && !new_slot->pci_dev) { if (new_slot && !new_slot->pci_dev)
cpqhp_configure_device(ctrl, new_slot); cpqhp_configure_device(ctrl, new_slot);
}
} while (new_slot); } while (new_slot);
mutex_lock(&ctrl->crit_sect); mutex_lock(&ctrl->crit_sect);
...@@ -2134,11 +2124,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) ...@@ -2134,11 +2124,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
/* If the VGA Enable bit is set, remove isn't /* If the VGA Enable bit is set, remove isn't
* supported */ * supported */
if (BCR & PCI_BRIDGE_CTL_VGA) { if (BCR & PCI_BRIDGE_CTL_VGA)
rc = REMOVE_NOT_SUPPORTED; rc = REMOVE_NOT_SUPPORTED;
} }
} }
}
func = cpqhp_slot_find(ctrl->bus, device, index++); func = cpqhp_slot_find(ctrl->bus, device, index++);
} }
...@@ -2333,9 +2322,9 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func ...@@ -2333,9 +2322,9 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func
while ((function < max_functions) && (!stop_it)) { while ((function < max_functions) && (!stop_it)) {
pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID);
if (ID == 0xFFFFFFFF) { /* There's nothing there. */ if (ID == 0xFFFFFFFF) {
function++; function++;
} else { /* There's something there */ } else {
/* Setup slot structure. */ /* Setup slot structure. */
new_slot = cpqhp_slot_create(func->bus); new_slot = cpqhp_slot_create(func->bus);
...@@ -2360,8 +2349,8 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func ...@@ -2360,8 +2349,8 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func
/* /*
Configuration logic that involves the hotplug data structures and * Configuration logic that involves the hotplug data structures and
their bookkeeping * their bookkeeping
*/ */
...@@ -2414,7 +2403,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func ...@@ -2414,7 +2403,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
if (rc) if (rc)
return rc; return rc;
if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */ if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {
/* set Primary bus */ /* set Primary bus */
dbg("set Primary bus = %d\n", func->bus); dbg("set Primary bus = %d\n", func->bus);
rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus); rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus);
...@@ -2956,12 +2945,11 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func ...@@ -2956,12 +2945,11 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func
/* Program IRQ based on card type */ /* Program IRQ based on card type */
rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code);
if (class_code == PCI_BASE_CLASS_STORAGE) { if (class_code == PCI_BASE_CLASS_STORAGE)
IRQ = cpqhp_disk_irq; IRQ = cpqhp_disk_irq;
} else { else
IRQ = cpqhp_nic_irq; IRQ = cpqhp_nic_irq;
} }
}
/* IRQ Line */ /* IRQ Line */
rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ); rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ);
......
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