aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/shpchp_core.c
diff options
context:
space:
mode:
authorrajesh.shah@intel.com <rajesh.shah@intel.com>2005-10-13 15:05:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 18:36:59 -0400
commitdbd7a78818d125a0ebd5507d4edb4dd5900006ab (patch)
tree682a1681aad47f70bfb760fca077f54589be92c6 /drivers/pci/hotplug/shpchp_core.c
parente3b1bd572f1cdb247bb4266a593b6894dc578d6a (diff)
[PATCH] shpchp: use the PCI core for hotplug resource management
This patch converts the standard hotplug controller driver to use the PCI core for resource management. This eliminates a whole lot of duplicated code, and integrates shpchp in the system's normal PCI handling code. Signed-off-by: Rajesh Shah <rajesh.shah@intel.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.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 6f7d8a29957a..8f5da504df34 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -418,16 +418,8 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
418 goto err_out_free_ctrl_bus; 418 goto err_out_free_ctrl_bus;
419 } 419 }
420 420
421 /* Get IO, memory, and IRQ resources for new devices */ 421 ctrl->add_support = 1;
422 rc = shpchprm_find_available_resources(ctrl);
423 ctrl->add_support = !rc;
424 422
425 if (rc) {
426 dbg("shpchprm_find_available_resources = %#x\n", rc);
427 err("unable to locate PCI configuration resources for hot plug add.\n");
428 goto err_out_free_ctrl_bus;
429 }
430
431 /* Setup the slot information structures */ 423 /* Setup the slot information structures */
432 rc = init_slots(ctrl); 424 rc = init_slots(ctrl);
433 if (rc) { 425 if (rc) {
@@ -497,18 +489,6 @@ static int shpc_start_thread(void)
497 return retval; 489 return retval;
498} 490}
499 491
500static inline void __exit
501free_shpchp_res(struct pci_resource *res)
502{
503 struct pci_resource *tres;
504
505 while (res) {
506 tres = res;
507 res = res->next;
508 kfree(tres);
509 }
510}
511
512static void __exit unload_shpchpd(void) 492static void __exit unload_shpchpd(void)
513{ 493{
514 struct pci_func *next; 494 struct pci_func *next;
@@ -522,11 +502,6 @@ static void __exit unload_shpchpd(void)
522 while (ctrl) { 502 while (ctrl) {
523 cleanup_slots(ctrl); 503 cleanup_slots(ctrl);
524 504
525 free_shpchp_res(ctrl->io_head);
526 free_shpchp_res(ctrl->mem_head);
527 free_shpchp_res(ctrl->p_mem_head);
528 free_shpchp_res(ctrl->bus_head);
529
530 kfree (ctrl->pci_bus); 505 kfree (ctrl->pci_bus);
531 506
532 dbg("%s: calling release_ctlr\n", __FUNCTION__); 507 dbg("%s: calling release_ctlr\n", __FUNCTION__);
@@ -541,11 +516,6 @@ static void __exit unload_shpchpd(void)
541 for (loop = 0; loop < 256; loop++) { 516 for (loop = 0; loop < 256; loop++) {
542 next = shpchp_slot_list[loop]; 517 next = shpchp_slot_list[loop];
543 while (next != NULL) { 518 while (next != NULL) {
544 free_shpchp_res(next->io_head);
545 free_shpchp_res(next->mem_head);
546 free_shpchp_res(next->p_mem_head);
547 free_shpchp_res(next->bus_head);
548
549 TempSlot = next; 519 TempSlot = next;
550 next = next->next; 520 next = next->next;
551 kfree(TempSlot); 521 kfree(TempSlot);
@@ -607,9 +577,7 @@ error_hpc_init:
607 if (retval) { 577 if (retval) {
608 shpchprm_cleanup(); 578 shpchprm_cleanup();
609 shpchp_event_stop_thread(); 579 shpchp_event_stop_thread();
610 } else 580 }
611 shpchprm_print_pirt();
612
613 return retval; 581 return retval;
614} 582}
615 583