linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath6kl: avoid flush_scheduled_work() usage
@ 2022-06-10 11:12 Tetsuo Handa
  2022-06-10 19:05 ` Jeff Johnson
  0 siblings, 1 reply; 8+ messages in thread
From: Tetsuo Handa @ 2022-06-10 11:12 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless

Use local wq in order to avoid flush_scheduled_work() usage.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
Please see commit c4f135d643823a86 ("workqueue: Wrap flush_workqueue()
using a macro") for background.

This is a blind conversion, and is only compile tested.

 drivers/net/wireless/ath/ath6kl/usb.c | 29 +++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 65e683effdcb..e3c65a671be1 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -21,6 +21,8 @@
 #include "debug.h"
 #include "core.h"
 
+static struct workqueue_struct *ath6kl_wq;
+
 /* constants */
 #define TX_URB_COUNT            32
 #define RX_URB_COUNT            32
@@ -478,7 +480,7 @@ static void ath6kl_usb_flush_all(struct ath6kl_usb *ar_usb)
 	 * Flushing any pending I/O may schedule work this call will block
 	 * until all scheduled work runs to completion.
 	 */
-	flush_scheduled_work();
+	flush_workqueue(ath6kl_wq);
 }
 
 static void ath6kl_usb_start_recv_pipes(struct ath6kl_usb *ar_usb)
@@ -544,7 +546,7 @@ static void ath6kl_usb_recv_complete(struct urb *urb)
 
 	/* note: queue implements a lock */
 	skb_queue_tail(&pipe->io_comp_queue, skb);
-	schedule_work(&pipe->io_complete_work);
+	queue_work(ath6kl_wq, &pipe->io_complete_work);
 
 cleanup_recv_urb:
 	ath6kl_usb_cleanup_recv_urb(urb_context);
@@ -579,7 +581,7 @@ static void ath6kl_usb_usb_transmit_complete(struct urb *urb)
 
 	/* note: queue implements a lock */
 	skb_queue_tail(&pipe->io_comp_queue, skb);
-	schedule_work(&pipe->io_complete_work);
+	queue_work(ath6kl_wq, &pipe->io_complete_work);
 }
 
 static void ath6kl_usb_io_comp_work(struct work_struct *work)
@@ -1234,7 +1236,26 @@ static struct usb_driver ath6kl_usb_driver = {
 	.disable_hub_initiated_lpm = 1,
 };
 
-module_usb_driver(ath6kl_usb_driver);
+static int __init ath6kl_init(void)
+{
+	int ret;
+
+	ath6kl_wq = alloc_workqueue("ath6kl_wq", 0, 0);
+	if (!ath6kl_wq)
+		return -ENOMEM;
+	ret = usb_register(&ath6kl_usb_driver);
+	if (ret)
+		destroy_workqueue(ath6kl_wq);
+	return ret;
+}
+module_init(ath6kl_init);
+
+static void __exit ath6kl_exit(void)
+{
+	usb_deregister(&ath6kl_usb_driver);
+	destroy_workqueue(ath6kl_wq);
+}
+module_exit(ath6kl_exit);
 
 MODULE_AUTHOR("Atheros Communications, Inc.");
 MODULE_DESCRIPTION("Driver support for Atheros AR600x USB devices");
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-20 10:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-10 11:12 [PATCH] ath6kl: avoid flush_scheduled_work() usage Tetsuo Handa
2022-06-10 19:05 ` Jeff Johnson
2022-06-10 19:10   ` Jeff Johnson
2022-06-10 22:51     ` Tetsuo Handa
2022-06-12  2:08       ` Tetsuo Handa
2022-06-13  8:01         ` Kalle Valo
2022-06-13 13:21           ` [PATCH v3] " Tetsuo Handa
2022-06-20 10:04             ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).