Commit 158fa67753e1eb3edfa5a2d1868666d89d1cf09f
1 parent
7fa5e85a0a
Exists in
master
and in
7 other branches
isdn/capi: make kcapi use a separate workqueue
flush_scheduled_work() is deprecated and will be removed. Because kcapi uses fire-and-forget type works, it's impossible to flush each work explicitly. Create and use a dedicated workqueue instead. Please note that with recent workqueue changes, each workqueue doesn't reserve a lot of resources and using it as a flush domain is fine. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Jan Kiszka <jan.kiszka@web.de>
Showing 1 changed file with 18 additions and 8 deletions Side-by-side Diff
drivers/isdn/capi/kcapi.c
... | ... | @@ -38,6 +38,7 @@ |
38 | 38 | #include <linux/rcupdate.h> |
39 | 39 | |
40 | 40 | static int showcapimsgs = 0; |
41 | +static struct workqueue_struct *kcapi_wq; | |
41 | 42 | |
42 | 43 | MODULE_DESCRIPTION("CAPI4Linux: kernel CAPI layer"); |
43 | 44 | MODULE_AUTHOR("Carsten Paeth"); |
... | ... | @@ -291,7 +292,7 @@ |
291 | 292 | event->type = event_type; |
292 | 293 | event->controller = controller; |
293 | 294 | |
294 | - schedule_work(&event->work); | |
295 | + queue_work(kcapi_wq, &event->work); | |
295 | 296 | return 0; |
296 | 297 | } |
297 | 298 | |
... | ... | @@ -408,7 +409,7 @@ |
408 | 409 | goto error; |
409 | 410 | } |
410 | 411 | skb_queue_tail(&ap->recv_queue, skb); |
411 | - schedule_work(&ap->recv_work); | |
412 | + queue_work(kcapi_wq, &ap->recv_work); | |
412 | 413 | rcu_read_unlock(); |
413 | 414 | |
414 | 415 | return; |
... | ... | @@ -743,7 +744,7 @@ |
743 | 744 | |
744 | 745 | mutex_unlock(&capi_controller_lock); |
745 | 746 | |
746 | - flush_scheduled_work(); | |
747 | + flush_workqueue(kcapi_wq); | |
747 | 748 | skb_queue_purge(&ap->recv_queue); |
748 | 749 | |
749 | 750 | if (showcapimsgs & 1) { |
750 | 751 | |
751 | 752 | |
752 | 753 | |
... | ... | @@ -1285,21 +1286,30 @@ |
1285 | 1286 | { |
1286 | 1287 | int err; |
1287 | 1288 | |
1289 | + kcapi_wq = alloc_workqueue("kcapi", 0, 0); | |
1290 | + if (!kcapi_wq) | |
1291 | + return -ENOMEM; | |
1292 | + | |
1288 | 1293 | register_capictr_notifier(&capictr_nb); |
1289 | 1294 | |
1290 | 1295 | err = cdebug_init(); |
1291 | - if (!err) | |
1292 | - kcapi_proc_init(); | |
1293 | - return err; | |
1296 | + if (err) { | |
1297 | + unregister_capictr_notifier(&capictr_nb); | |
1298 | + destroy_workqueue(kcapi_wq); | |
1299 | + return err; | |
1300 | + } | |
1301 | + | |
1302 | + kcapi_proc_init(); | |
1303 | + return 0; | |
1294 | 1304 | } |
1295 | 1305 | |
1296 | 1306 | static void __exit kcapi_exit(void) |
1297 | 1307 | { |
1298 | 1308 | kcapi_proc_exit(); |
1299 | 1309 | |
1300 | - /* make sure all notifiers are finished */ | |
1301 | - flush_scheduled_work(); | |
1310 | + unregister_capictr_notifier(&capictr_nb); | |
1302 | 1311 | cdebug_exit(); |
1312 | + destroy_workqueue(kcapi_wq); | |
1303 | 1313 | } |
1304 | 1314 | |
1305 | 1315 | module_init(kcapi_init); |