All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Ashok Raj <ashok.raj@intel.com>,
	Keith Busch <keith.busch@intel.com>,
	Yinghai Lu <yinghai@kernel.org>, Sinan Kaya <okaya@kernel.org>,
	linux-pci@vger.kernel.org
Subject: [PATCH 13/32] PCI: pciehp: Drop slot workqueue
Date: Sat, 16 Jun 2018 21:25:00 +0200	[thread overview]
Message-ID: <034a190ba172c91adb0a9cc5225716d4aa69d78e.1529173804.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1529173804.git.lukas@wunner.de>

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>
---
 drivers/pci/hotplug/pciehp.h      | 2 --
 drivers/pci/hotplug/pciehp_core.c | 6 ------
 drivers/pci/hotplug/pciehp_ctrl.c | 2 +-
 drivers/pci/hotplug/pciehp_hpc.c  | 9 +--------
 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 {									\
  *	protects scheduling, execution and cancellation of @work
  * @hotplug_lock: serializes calls to pciehp_enable_slot() and
  *	pciehp_disable_slot()
- * @wq: work queue on which @work is scheduled
  */
 struct slot {
 	u8 state;
@@ -78,7 +77,6 @@ struct slot {
 	struct delayed_work work;
 	struct mutex lock;
 	struct mutex hotplug_lock;
-	struct workqueue_struct *wq;
 };
 
 /**
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);
  */
 static void release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = hotplug_slot->private;
-
-	/* queued work needs hotplug_slot name */
-	cancel_delayed_work(&slot->work);
-	drain_workqueue(slot->wq);
-
 	kfree(hotplug_slot->ops);
 	kfree(hotplug_slot->info);
 	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)
 		/* blink green LED and turn off amber */
 		pciehp_green_led_blink(p_slot);
 		pciehp_set_attention_status(p_slot, 0);
-		queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ);
+		schedule_delayed_work(&p_slot->work, 5 * HZ);
 		break;
 	case BLINKINGOFF_STATE:
 	case BLINKINGON_STATE:
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index bc70762cbba1..0898501eea93 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -767,25 +767,18 @@ static int pcie_init_slot(struct controller *ctrl)
 	if (!slot)
 		return -ENOMEM;
 
-	slot->wq = alloc_ordered_workqueue("pciehp-%u", 0, PSN(ctrl));
-	if (!slot->wq)
-		goto abort;
-
 	slot->ctrl = ctrl;
 	mutex_init(&slot->lock);
 	mutex_init(&slot->hotplug_lock);
 	INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
 	ctrl->slot = slot;
 	return 0;
-abort:
-	kfree(slot);
-	return -ENOMEM;
 }
 
 static void pcie_cleanup_slot(struct controller *ctrl)
 {
 	struct slot *slot = ctrl->slot;
-	destroy_workqueue(slot->wq);
+	cancel_delayed_work_sync(&slot->work);
 	kfree(slot);
 }
 
-- 
2.17.1

  parent reply	other threads:[~2018-06-16 19:38 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-16 19:25 [PATCH 00/32] Rework pciehp event handling & add runtime PM Lukas Wunner
2018-06-16 19:25 ` [PATCH 04/32] PCI: pciehp: Fix unprotected list iteration in IRQ handler Lukas Wunner
2018-06-16 19:25 ` [PATCH 08/32] genirq: Synchronize only with single thread on free_irq() Lukas Wunner
2018-07-12 22:21   ` Bjorn Helgaas
2018-07-13  7:21     ` Lukas Wunner
2018-07-13 11:44       ` Bjorn Helgaas
2018-07-16 12:37       ` Bjorn Helgaas
2018-07-16 13:37         ` Lukas Wunner
2018-06-16 19:25 ` [PATCH 31/32] PCI: Whitelist native hotplug ports for runtime D3 Lukas Wunner
2018-06-16 19:25 ` [PATCH 19/32] PCI: pciehp: Declare pciehp_enable/disable_slot() static Lukas Wunner
2018-06-16 19:25 ` [PATCH 11/32] PCI: pciehp: Stop blinking on slot enable failure Lukas Wunner
2018-06-16 19:25 ` [PATCH 23/32] PCI: pciehp: Avoid slot access during reset Lukas Wunner
2018-06-21 12:06   ` Mika Westerberg
2018-06-22  9:23     ` Lukas Wunner
2018-06-25 13:10       ` Mika Westerberg
2018-06-16 19:25 ` [PATCH 01/32] PCI: hotplug: Don't leak pci_slot on registration failure Lukas Wunner
2018-06-16 19:25 ` [PATCH 26/32] PCI: pciehp: Obey compulsory command delay after resume Lukas Wunner
2018-06-16 19:25 ` [PATCH 15/32] PCI: pciehp: Publish to user space last on probe Lukas Wunner
2018-06-16 19:25 ` [PATCH 16/32] PCI: pciehp: Track enable/disable status Lukas Wunner
2018-06-16 19:25 ` [PATCH 32/32] PCI: Whitelist Thunderbolt ports for runtime D3 Lukas Wunner
2018-06-21 11:13   ` Mika Westerberg
2018-07-18 19:30     ` Lukas Wunner
2018-07-20 15:23       ` Mika Westerberg
2018-07-20 16:00         ` Mika Westerberg
2018-07-20 20:33           ` Bjorn Helgaas
2018-06-16 19:25 ` [PATCH 06/32] PCI: pciehp: Declare pciehp_unconfigure_device() void Lukas Wunner
2018-06-16 19:25 ` [PATCH 28/32] PCI: pciehp: Resume to D0 on enable/disable Lukas Wunner
2018-06-16 19:25 ` [PATCH 22/32] PCI: pciehp: Always enable occupied slot on probe Lukas Wunner
2018-06-16 19:25 ` [PATCH 10/32] PCI: pciehp: Convert to threaded polling Lukas Wunner
2018-06-16 19:25 ` Lukas Wunner [this message]
2018-06-16 19:25 ` [PATCH 12/32] PCI: pciehp: Handle events synchronously Lukas Wunner
2018-06-16 19:25 ` [PATCH 21/32] PCI: pciehp: Become resilient to missed events Lukas Wunner
2018-06-16 19:25 ` [PATCH 25/32] PCI: pciehp: Clear spurious events earlier on resume Lukas Wunner
2018-06-16 19:25 ` [PATCH 02/32] PCI: pciehp: Fix UAF on unplug Lukas Wunner
2018-06-16 19:25 ` [PATCH 29/32] PCI: pciehp: Resume parent to D0 on config space access Lukas Wunner
2018-06-16 19:25 ` [PATCH 17/32] PCI: pciehp: Enable/disable exclusively from IRQ thread Lukas Wunner
2018-06-21 11:58   ` Mika Westerberg
2018-06-16 19:25 ` [PATCH 09/32] PCI: pciehp: Convert to threaded IRQ Lukas Wunner
2018-06-19 23:16   ` Keith Busch
2018-06-20 11:01     ` Lukas Wunner
2018-06-16 19:25 ` [PATCH 07/32] PCI: pciehp: Document struct slot and struct controller Lukas Wunner
2018-06-16 19:25 ` [PATCH 20/32] PCI: pciehp: Tolerate initially unstable link Lukas Wunner
2018-06-16 19:25 ` [PATCH 05/32] PCI: pciehp: Drop unnecessary NULL pointer check Lukas Wunner
2018-06-16 19:25 ` [PATCH 30/32] PCI: sysfs: Resume to D0 on function reset Lukas Wunner
2018-06-16 19:25 ` [PATCH 03/32] PCI: pciehp: Fix deadlock on unplug Lukas Wunner
2018-09-06 16:01   ` Mika Westerberg
2018-09-06 16:26     ` Lukas Wunner
2018-09-06 18:08       ` Mika Westerberg
2018-06-16 19:25 ` [PATCH 18/32] PCI: pciehp: Drop enable/disable lock Lukas Wunner
2018-06-16 19:25 ` [PATCH 14/32] PCI: hotplug: Demidlayer registration with the core Lukas Wunner
2018-06-17 16:44   ` Andy Shevchenko
2018-07-16 12:46     ` Bjorn Helgaas
2018-07-16 14:14       ` Andy Shevchenko
2018-06-16 19:25 ` [PATCH 24/32] PCI: portdrv: Deduplicate PM callback iterator Lukas Wunner
2018-06-16 19:25 ` [PATCH 27/32] PCI: pciehp: Support interrupts sent from D3hot Lukas Wunner
2018-07-12 23:03   ` Bjorn Helgaas
2018-06-21 12:19 ` [PATCH 00/32] Rework pciehp event handling & add runtime PM Mika Westerberg
2018-06-27 13:35   ` Patel, Mayurkumar
2018-07-12 22:28 ` Bjorn Helgaas
2018-07-13  7:54   ` Lukas Wunner
2018-07-13 11:43     ` Bjorn Helgaas
2018-07-16 14:20 ` Bjorn Helgaas
2018-07-19  9:43   ` Lukas Wunner
2018-07-19 19:05     ` Bjorn Helgaas
2018-07-19 22:50     ` Bjorn Helgaas
2018-07-28  5:44       ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=034a190ba172c91adb0a9cc5225716d4aa69d78e.1529173804.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=ashok.raj@intel.com \
    --cc=bhelgaas@google.com \
    --cc=keith.busch@intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=okaya@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.