diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 25 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_ctrl.c | 2 |
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 | ||
80 | struct controller { | 80 | struct 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 */ |
207 | extern struct controller *shpchp_ctrl_list; | 207 | extern struct list_head shpchp_ctrl_list; |
208 | 208 | ||
209 | struct ctrl_reg { | 209 | struct 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 @@ | |||
38 | int shpchp_debug; | 38 | int shpchp_debug; |
39 | int shpchp_poll_mode; | 39 | int shpchp_poll_mode; |
40 | int shpchp_poll_time; | 40 | int shpchp_poll_time; |
41 | struct controller *shpchp_ctrl_list; /* = NULL */ | 41 | LIST_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 | ||
494 | static void __exit unload_shpchpd(void) | 488 | static 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"); |