summaryrefslogtreecommitdiff
path: root/drivers/pci/hotplug/shpchp_core.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-01-26 09:58:30 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:35:11 -0800
commita4534560815ffc525bfbe465a290ce048aab4c01 (patch)
tree28a444dc6b9667bdf16f83ab7a339ff7c5e820a2 /drivers/pci/hotplug/shpchp_core.c
parent5b1a960d180e9660a87b0c661a754efabc1b1d3a (diff)
[PATCH] shpchp - cleanup controller list
This patch changes SHPCHP driver to use list_head structure for managing controller 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.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 547bf5d6fcca..0dd0642e691b 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -38,7 +38,7 @@
int shpchp_debug;
int shpchp_poll_mode;
int shpchp_poll_time;
-struct controller *shpchp_ctrl_list; /* = NULL */
+LIST_HEAD(shpchp_ctrl_list);
#define DRIVER_VERSION "0.4"
#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
@@ -452,13 +452,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Finish setting up the hot plug ctrl device */
ctrl->next_event = 0;
- if (!shpchp_ctrl_list) {
- shpchp_ctrl_list = ctrl;
- ctrl->next = NULL;
- } else {
- ctrl->next = shpchp_ctrl_list;
- shpchp_ctrl_list = ctrl;
- }
+ list_add(&ctrl->ctrl_list, &shpchp_ctrl_list);
shpchp_create_ctrl_files(ctrl);
@@ -493,22 +487,17 @@ static int shpc_start_thread(void)
static void __exit unload_shpchpd(void)
{
+ struct list_head *tmp;
+ struct list_head *next;
struct controller *ctrl;
- struct controller *tctrl;
-
- ctrl = shpchp_ctrl_list;
- while (ctrl) {
+ list_for_each_safe(tmp, next, &shpchp_ctrl_list) {
+ ctrl = list_entry(tmp, struct controller, ctrl_list);
shpchp_remove_ctrl_files(ctrl);
cleanup_slots(ctrl);
-
kfree (ctrl->pci_bus);
ctrl->hpc_ops->release_ctlr(ctrl);
-
- tctrl = ctrl;
- ctrl = ctrl->next;
-
- kfree(tctrl);
+ kfree(ctrl);
}
/* Stop the notification mechanism */