Commit 62ebaf2f authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Kalle Valo

ath6kl: avoid flush_scheduled_work() usage

As per commit c4f135d6 ("workqueue: Wrap flush_workqueue() using
a macro") says, use per "struct ath6kl_usb" workqueue.

This is a blind conversion, and is only compile tested.
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/f78ddbdc-8989-a1a7-2234-ce9ec3894625@I-love.SAKURA.ne.jp
parent d7fc7603
...@@ -71,6 +71,7 @@ struct ath6kl_usb { ...@@ -71,6 +71,7 @@ struct ath6kl_usb {
u8 *diag_cmd_buffer; u8 *diag_cmd_buffer;
u8 *diag_resp_buffer; u8 *diag_resp_buffer;
struct ath6kl *ar; struct ath6kl *ar;
struct workqueue_struct *wq;
}; };
/* usb urb object */ /* usb urb object */
...@@ -478,7 +479,7 @@ static void ath6kl_usb_flush_all(struct ath6kl_usb *ar_usb) ...@@ -478,7 +479,7 @@ static void ath6kl_usb_flush_all(struct ath6kl_usb *ar_usb)
* Flushing any pending I/O may schedule work this call will block * Flushing any pending I/O may schedule work this call will block
* until all scheduled work runs to completion. * until all scheduled work runs to completion.
*/ */
flush_scheduled_work(); flush_workqueue(ar_usb->wq);
} }
static void ath6kl_usb_start_recv_pipes(struct ath6kl_usb *ar_usb) static void ath6kl_usb_start_recv_pipes(struct ath6kl_usb *ar_usb)
...@@ -544,7 +545,7 @@ static void ath6kl_usb_recv_complete(struct urb *urb) ...@@ -544,7 +545,7 @@ static void ath6kl_usb_recv_complete(struct urb *urb)
/* note: queue implements a lock */ /* note: queue implements a lock */
skb_queue_tail(&pipe->io_comp_queue, skb); skb_queue_tail(&pipe->io_comp_queue, skb);
schedule_work(&pipe->io_complete_work); queue_work(pipe->ar_usb->wq, &pipe->io_complete_work);
cleanup_recv_urb: cleanup_recv_urb:
ath6kl_usb_cleanup_recv_urb(urb_context); ath6kl_usb_cleanup_recv_urb(urb_context);
...@@ -579,7 +580,7 @@ static void ath6kl_usb_usb_transmit_complete(struct urb *urb) ...@@ -579,7 +580,7 @@ static void ath6kl_usb_usb_transmit_complete(struct urb *urb)
/* note: queue implements a lock */ /* note: queue implements a lock */
skb_queue_tail(&pipe->io_comp_queue, skb); skb_queue_tail(&pipe->io_comp_queue, skb);
schedule_work(&pipe->io_complete_work); queue_work(pipe->ar_usb->wq, &pipe->io_complete_work);
} }
static void ath6kl_usb_io_comp_work(struct work_struct *work) static void ath6kl_usb_io_comp_work(struct work_struct *work)
...@@ -619,6 +620,7 @@ static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb) ...@@ -619,6 +620,7 @@ static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb)
kfree(ar_usb->diag_cmd_buffer); kfree(ar_usb->diag_cmd_buffer);
kfree(ar_usb->diag_resp_buffer); kfree(ar_usb->diag_resp_buffer);
destroy_workqueue(ar_usb->wq);
kfree(ar_usb); kfree(ar_usb);
} }
...@@ -631,9 +633,15 @@ static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interface) ...@@ -631,9 +633,15 @@ static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interface)
int status = 0; int status = 0;
int i; int i;
/* ath6kl_usb_destroy() needs ar_usb != NULL && ar_usb->wq != NULL. */
ar_usb = kzalloc(sizeof(struct ath6kl_usb), GFP_KERNEL); ar_usb = kzalloc(sizeof(struct ath6kl_usb), GFP_KERNEL);
if (ar_usb == NULL) if (ar_usb == NULL)
goto fail_ath6kl_usb_create; return NULL;
ar_usb->wq = alloc_workqueue("ath6kl_wq", 0, 0);
if (!ar_usb->wq) {
kfree(ar_usb);
return NULL;
}
usb_set_intfdata(interface, ar_usb); usb_set_intfdata(interface, ar_usb);
spin_lock_init(&(ar_usb->cs_lock)); spin_lock_init(&(ar_usb->cs_lock));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment