Skip to content

Commit

Permalink
char: xillybus: Refine workqueue handling
Browse files Browse the repository at this point in the history
As the wakeup work item now runs on a separate workqueue, it needs to be
flushed separately along with flushing the device's workqueue.

Also, move the destroy_workqueue() call to the end of the exit method,
so that deinitialization is done in the opposite order of
initialization.

Fixes: ccbde4b ("char: xillybus: Don't destroy workqueue from work item running on it")
Cc: stable <stable@kernel.org>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://lore.kernel.org/r/20240816070200.50695-1-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Eli Billauer authored and Greg Kroah-Hartman committed Aug 16, 2024
1 parent 9bb5e74 commit ad899c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/char/xillybus/xillyusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2093,9 +2093,11 @@ static int xillyusb_discovery(struct usb_interface *interface)
* just after responding with the IDT, there is no reason for any
* work item to be running now. To be sure that xdev->channels
* is updated on anything that might run in parallel, flush the
* workqueue, which rarely does anything.
* device's workqueue and the wakeup work item. This rarely
* does anything.
*/
flush_workqueue(xdev->workq);
flush_work(&xdev->wakeup_workitem);

xdev->num_channels = num_channels;

Expand Down Expand Up @@ -2274,9 +2276,9 @@ static int __init xillyusb_init(void)

static void __exit xillyusb_exit(void)
{
destroy_workqueue(wakeup_wq);

usb_deregister(&xillyusb_driver);

destroy_workqueue(wakeup_wq);
}

module_init(xillyusb_init);
Expand Down

0 comments on commit ad899c3

Please sign in to comment.