aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/hotplug/shpchp_core.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-01-26 09:57:40 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:35:11 -0800
commit5b1a960d180e9660a87b0c661a754efabc1b1d3a (patch)
treef49931b000ff784c3267f134ff3734f640fcd5d7 /drivers/pci/hotplug/shpchp_core.c
parentdfcd5f68ec916414532e88583d1557b6ac0197f5 (diff)
[PATCH] shpchp - cleanup slot list
This patch changes SHPCHP driver to use list_head structure for managing slot list. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp_core.c')
-rw-r--r--drivers/pci/hotplug/shpchp_core.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 7f2e775534e..547bf5d6fcc 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -173,8 +173,7 @@ static int init_slots(struct controller *ctrl)
goto error_name;
}
- slot->next = ctrl->slot;
- ctrl->slot = slot;
+ list_add(&slot->slot_list, &ctrl->slot_list);
}
return 0;
@@ -192,15 +191,14 @@ error:
static void cleanup_slots(struct controller *ctrl)
{
- struct slot *old_slot, *next_slot;
-
- old_slot = ctrl->slot;
- ctrl->slot = NULL;
+ struct list_head *tmp;
+ struct list_head *next;
+ struct slot *slot;
- while (old_slot) {
- next_slot = old_slot->next;
- pci_hp_deregister(old_slot->hotplug_slot);
- old_slot = next_slot;
+ list_for_each_safe(tmp, next, &ctrl->slot_list) {
+ slot = list_entry(tmp, struct slot, slot_list);
+ list_del(&slot->slot_list);
+ pci_hp_deregister(slot->hotplug_slot);
}
}
@@ -391,6 +389,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_none;
}
memset(ctrl, 0, sizeof(struct controller));
+ INIT_LIST_HEAD(&ctrl->slot_list);
rc = shpc_init(ctrl, pdev);
if (rc) {