diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2006-05-03 10:42:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-19 17:13:23 -0400 |
commit | 82d5f4aaf182c306d2c2ef4d3a89d0fb8e386aa8 (patch) | |
tree | ef7de5f12bee715364576d84bd47a05f61326d05 /drivers/pci/hotplug/shpchp_hpc.c | |
parent | d49f2c49c39bbd0cb2069fe11c1630c709061037 (diff) |
[PATCH] shpchp: Create shpchpd at controller probe time
The workqueue thread of shpchp driver should be created only when SHPC
based hotplug slots are detected on the system.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Kristen Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp_hpc.c')
-rw-r--r-- | drivers/pci/hotplug/shpchp_hpc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 8b63f772a6f2..5e8f589d0b64 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c | |||
@@ -216,6 +216,8 @@ static struct php_ctlr_state_s *php_ctlr_list_head; /* HPC state linked list */ | |||
216 | static int ctlr_seq_num = 0; /* Controller sequenc # */ | 216 | static int ctlr_seq_num = 0; /* Controller sequenc # */ |
217 | static spinlock_t list_lock; | 217 | static spinlock_t list_lock; |
218 | 218 | ||
219 | static atomic_t shpchp_num_controllers = ATOMIC_INIT(0); | ||
220 | |||
219 | static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs); | 221 | static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs); |
220 | 222 | ||
221 | static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds); | 223 | static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds); |
@@ -866,6 +868,13 @@ static void hpc_release_ctlr(struct controller *ctrl) | |||
866 | 868 | ||
867 | kfree(php_ctlr); | 869 | kfree(php_ctlr); |
868 | 870 | ||
871 | /* | ||
872 | * If this is the last controller to be released, destroy the | ||
873 | * shpchpd work queue | ||
874 | */ | ||
875 | if (atomic_dec_and_test(&shpchp_num_controllers)) | ||
876 | destroy_workqueue(shpchp_wq); | ||
877 | |||
869 | DBG_LEAVE_ROUTINE | 878 | DBG_LEAVE_ROUTINE |
870 | 879 | ||
871 | } | 880 | } |
@@ -1461,6 +1470,16 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev) | |||
1461 | ctlr_seq_num++; | 1470 | ctlr_seq_num++; |
1462 | 1471 | ||
1463 | /* | 1472 | /* |
1473 | * If this is the first controller to be initialized, | ||
1474 | * initialize the shpchpd work queue | ||
1475 | */ | ||
1476 | if (atomic_add_return(1, &shpchp_num_controllers) == 1) { | ||
1477 | shpchp_wq = create_singlethread_workqueue("shpchpd"); | ||
1478 | if (!shpchp_wq) | ||
1479 | return -ENOMEM; | ||
1480 | } | ||
1481 | |||
1482 | /* | ||
1464 | * Unmask all event interrupts of all slots | 1483 | * Unmask all event interrupts of all slots |
1465 | */ | 1484 | */ |
1466 | for (hp_slot = 0; hp_slot < php_ctlr->num_slots; hp_slot++) { | 1485 | for (hp_slot = 0; hp_slot < php_ctlr->num_slots; hp_slot++) { |