aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-01-25 19:58:30 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:35:11 -0500
commita4534560815ffc525bfbe465a290ce048aab4c01 (patch)
tree28a444dc6b9667bdf16f83ab7a339ff7c5e820a2 /drivers
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')
-rw-r--r--drivers/pci/hotplug/shpchp.h4
-rw-r--r--drivers/pci/hotplug/shpchp_core.c25
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c2
3 files changed, 10 insertions, 21 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index c0be7a1c3ff7..f6d606dde691 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -78,7 +78,7 @@ struct event_info {
78}; 78};
79 79
80struct controller { 80struct controller {
81 struct controller *next; 81 struct list_head ctrl_list;
82 struct mutex crit_sect; /* critical section mutex */ 82 struct mutex crit_sect; /* critical section mutex */
83 struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ 83 struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
84 int num_slots; /* Number of slots on ctlr */ 84 int num_slots; /* Number of slots on ctlr */
@@ -204,7 +204,7 @@ extern void shpchp_remove_ctrl_files(struct controller *ctrl);
204 204
205 205
206/* Global variables */ 206/* Global variables */
207extern struct controller *shpchp_ctrl_list; 207extern struct list_head shpchp_ctrl_list;
208 208
209struct ctrl_reg { 209struct ctrl_reg {
210 volatile u32 base_offset; 210 volatile u32 base_offset;
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 @@
38int shpchp_debug; 38int shpchp_debug;
39int shpchp_poll_mode; 39int shpchp_poll_mode;
40int shpchp_poll_time; 40int shpchp_poll_time;
41struct controller *shpchp_ctrl_list; /* = NULL */ 41LIST_HEAD(shpchp_ctrl_list);
42 42
43#define DRIVER_VERSION "0.4" 43#define DRIVER_VERSION "0.4"
44#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" 44#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)
452 /* Finish setting up the hot plug ctrl device */ 452 /* Finish setting up the hot plug ctrl device */
453 ctrl->next_event = 0; 453 ctrl->next_event = 0;
454 454
455 if (!shpchp_ctrl_list) { 455 list_add(&ctrl->ctrl_list, &shpchp_ctrl_list);
456 shpchp_ctrl_list = ctrl;
457 ctrl->next = NULL;
458 } else {
459 ctrl->next = shpchp_ctrl_list;
460 shpchp_ctrl_list = ctrl;
461 }
462 456
463 shpchp_create_ctrl_files(ctrl); 457 shpchp_create_ctrl_files(ctrl);
464 458
@@ -493,22 +487,17 @@ static int shpc_start_thread(void)
493 487
494static void __exit unload_shpchpd(void) 488static void __exit unload_shpchpd(void)
495{ 489{
490 struct list_head *tmp;
491 struct list_head *next;
496 struct controller *ctrl; 492 struct controller *ctrl;
497 struct controller *tctrl;
498
499 ctrl = shpchp_ctrl_list;
500 493
501 while (ctrl) { 494 list_for_each_safe(tmp, next, &shpchp_ctrl_list) {
495 ctrl = list_entry(tmp, struct controller, ctrl_list);
502 shpchp_remove_ctrl_files(ctrl); 496 shpchp_remove_ctrl_files(ctrl);
503 cleanup_slots(ctrl); 497 cleanup_slots(ctrl);
504
505 kfree (ctrl->pci_bus); 498 kfree (ctrl->pci_bus);
506 ctrl->hpc_ops->release_ctlr(ctrl); 499 ctrl->hpc_ops->release_ctlr(ctrl);
507 500 kfree(ctrl);
508 tctrl = ctrl;
509 ctrl = ctrl->next;
510
511 kfree(tctrl);
512 } 501 }
513 502
514 /* Stop the notification mechanism */ 503 /* Stop the notification mechanism */
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 65e69252e2f9..3a8e733aead5 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -688,7 +688,7 @@ static int event_thread(void* data)
688 if (pushbutton_pending) 688 if (pushbutton_pending)
689 shpchp_pushbutton_thread(pushbutton_pending); 689 shpchp_pushbutton_thread(pushbutton_pending);
690 else 690 else
691 for (ctrl = shpchp_ctrl_list; ctrl; ctrl=ctrl->next) 691 list_for_each_entry(ctrl, &shpchp_ctrl_list, ctrl_list)
692 interrupt_event_handler(ctrl); 692 interrupt_event_handler(ctrl);
693 } 693 }
694 dbg("event_thread signals exit\n"); 694 dbg("event_thread signals exit\n");