aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2018-07-19 18:27:42 -0400
committerBjorn Helgaas <helgaas@kernel.org>2018-07-23 18:04:13 -0400
commit55a6b7a6576d6cba77bb2ce2bfb2126df83df58a (patch)
tree7c496fba003e8f656ee79cd5108bfd982af90c1c /drivers/pci/hotplug
parent0e94916e6091f48391b65110e71c87c583021640 (diff)
PCI: pciehp: Drop slot workqueue
Previously the slot workqueue was used to handle events and enable or disable the slot. That's no longer the case as those tasks are done synchronously in the IRQ thread. The slot workqueue is thus merely used to handle a button press after the 5 second delay and only one such work item may be in flight at any given time. A separate workqueue isn't necessary for this simple task, so use the system workqueue instead. Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/pciehp.h2
-rw-r--r--drivers/pci/hotplug/pciehp_core.c6
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c2
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c9
4 files changed, 2 insertions, 17 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 82ff77cc92f5..0d005c5fabfa 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -69,7 +69,6 @@ do { \
69 * protects scheduling, execution and cancellation of @work 69 * protects scheduling, execution and cancellation of @work
70 * @hotplug_lock: serializes calls to pciehp_enable_slot() and 70 * @hotplug_lock: serializes calls to pciehp_enable_slot() and
71 * pciehp_disable_slot() 71 * pciehp_disable_slot()
72 * @wq: work queue on which @work is scheduled
73 */ 72 */
74struct slot { 73struct slot {
75 u8 state; 74 u8 state;
@@ -78,7 +77,6 @@ struct slot {
78 struct delayed_work work; 77 struct delayed_work work;
79 struct mutex lock; 78 struct mutex lock;
80 struct mutex hotplug_lock; 79 struct mutex hotplug_lock;
81 struct workqueue_struct *wq;
82}; 80};
83 81
84/** 82/**
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 8a2133856dfd..b360645377c2 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -62,12 +62,6 @@ static int reset_slot(struct hotplug_slot *slot, int probe);
62 */ 62 */
63static void release_slot(struct hotplug_slot *hotplug_slot) 63static void release_slot(struct hotplug_slot *hotplug_slot)
64{ 64{
65 struct slot *slot = hotplug_slot->private;
66
67 /* queued work needs hotplug_slot name */
68 cancel_delayed_work(&slot->work);
69 drain_workqueue(slot->wq);
70
71 kfree(hotplug_slot->ops); 65 kfree(hotplug_slot->ops);
72 kfree(hotplug_slot->info); 66 kfree(hotplug_slot->info);
73 kfree(hotplug_slot); 67 kfree(hotplug_slot);
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 5763e81be2ed..a4a8a5457aca 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -165,7 +165,7 @@ void pciehp_handle_button_press(struct slot *p_slot)
165 /* blink green LED and turn off amber */ 165 /* blink green LED and turn off amber */
166 pciehp_green_led_blink(p_slot); 166 pciehp_green_led_blink(p_slot);
167 pciehp_set_attention_status(p_slot, 0); 167 pciehp_set_attention_status(p_slot, 0);
168 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); 168 schedule_delayed_work(&p_slot->work, 5 * HZ);
169 break; 169 break;
170 case BLINKINGOFF_STATE: 170 case BLINKINGOFF_STATE:
171 case BLINKINGON_STATE: 171 case BLINKINGON_STATE:
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 31544998e1bd..dcbdee50cd85 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -767,26 +767,19 @@ static int pcie_init_slot(struct controller *ctrl)
767 if (!slot) 767 if (!slot)
768 return -ENOMEM; 768 return -ENOMEM;
769 769
770 slot->wq = alloc_ordered_workqueue("pciehp-%u", 0, PSN(ctrl));
771 if (!slot->wq)
772 goto abort;
773
774 slot->ctrl = ctrl; 770 slot->ctrl = ctrl;
775 mutex_init(&slot->lock); 771 mutex_init(&slot->lock);
776 mutex_init(&slot->hotplug_lock); 772 mutex_init(&slot->hotplug_lock);
777 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); 773 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
778 ctrl->slot = slot; 774 ctrl->slot = slot;
779 return 0; 775 return 0;
780abort:
781 kfree(slot);
782 return -ENOMEM;
783} 776}
784 777
785static void pcie_cleanup_slot(struct controller *ctrl) 778static void pcie_cleanup_slot(struct controller *ctrl)
786{ 779{
787 struct slot *slot = ctrl->slot; 780 struct slot *slot = ctrl->slot;
788 781
789 destroy_workqueue(slot->wq); 782 cancel_delayed_work_sync(&slot->work);
790 kfree(slot); 783 kfree(slot);
791} 784}
792 785