aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/shpchp_hpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/shpchp_hpc.c')
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c19
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 */
216static int ctlr_seq_num = 0; /* Controller sequenc # */ 216static int ctlr_seq_num = 0; /* Controller sequenc # */
217static spinlock_t list_lock; 217static spinlock_t list_lock;
218 218
219static atomic_t shpchp_num_controllers = ATOMIC_INIT(0);
220
219static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs); 221static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs);
220 222
221static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds); 223static 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
869DBG_LEAVE_ROUTINE 878DBG_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++) {