@@ -50,6 +50,7 @@ MODULE_LICENSE("GPL v2");
50
50
static const char xillyname [] = "xillyusb" ;
51
51
52
52
static unsigned int fifo_buf_order ;
53
+ static struct workqueue_struct * wakeup_wq ;
53
54
54
55
#define USB_VENDOR_ID_XILINX 0x03fd
55
56
#define USB_VENDOR_ID_ALTERA 0x09fb
@@ -569,10 +570,6 @@ static void cleanup_dev(struct kref *kref)
569
570
* errors if executed. The mechanism relies on that xdev->error is assigned
570
571
* a non-zero value by report_io_error() prior to queueing wakeup_all(),
571
572
* which prevents bulk_in_work() from calling process_bulk_in().
572
- *
573
- * The fact that wakeup_all() and bulk_in_work() are queued on the same
574
- * workqueue makes their concurrent execution very unlikely, however the
575
- * kernel's API doesn't seem to ensure this strictly.
576
573
*/
577
574
578
575
static void wakeup_all (struct work_struct * work )
@@ -627,7 +624,7 @@ static void report_io_error(struct xillyusb_dev *xdev,
627
624
628
625
if (do_once ) {
629
626
kref_get (& xdev -> kref ); /* xdev is used by work item */
630
- queue_work (xdev -> workq , & xdev -> wakeup_workitem );
627
+ queue_work (wakeup_wq , & xdev -> wakeup_workitem );
631
628
}
632
629
}
633
630
@@ -2258,18 +2255,27 @@ static int __init xillyusb_init(void)
2258
2255
{
2259
2256
int rc = 0 ;
2260
2257
2258
+ wakeup_wq = alloc_workqueue (xillyname , 0 , 0 );
2259
+ if (!wakeup_wq )
2260
+ return - ENOMEM ;
2261
+
2261
2262
if (LOG2_INITIAL_FIFO_BUF_SIZE > PAGE_SHIFT )
2262
2263
fifo_buf_order = LOG2_INITIAL_FIFO_BUF_SIZE - PAGE_SHIFT ;
2263
2264
else
2264
2265
fifo_buf_order = 0 ;
2265
2266
2266
2267
rc = usb_register (& xillyusb_driver );
2267
2268
2269
+ if (rc )
2270
+ destroy_workqueue (wakeup_wq );
2271
+
2268
2272
return rc ;
2269
2273
}
2270
2274
2271
2275
static void __exit xillyusb_exit (void )
2272
2276
{
2277
+ destroy_workqueue (wakeup_wq );
2278
+
2273
2279
usb_deregister (& xillyusb_driver );
2274
2280
}
2275
2281
0 commit comments