diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-02-20 15:15:38 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-20 15:02:06 -0800 |
commit | e3479f774e10b1fe9cd1d8aa730c5332812c4ba0 (patch) | |
tree | 803adb2d8083f7cf0a3c0e49a42cd7b0754bb7ab /drivers | |
parent | a642bbbb4138568cd85217a328c899a5203b4d20 (diff) | |
download | linux-e3479f774e10b1fe9cd1d8aa730c5332812c4ba0.tar.bz2 |
staging: most: hdm-usb: Remove create_workqueue()
With concurrency managed workqueues, use of dedicated workqueues can
be replaced by using system_wq. Drop schedule_usb_work by using
system_wq.
Since there is only one work item per buf_anchor and most_dev and they
do not need to be ordered, increase of concurrency by switching to
system_wq should not break anything.
Both work items are sync canceled before the driver can be
unregistered, to ensure no work item is pending or executing on any
CPU by the time exit path is in flight.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/most/hdm-usb/hdm_usb.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index 41690f801fb8..3ee9e6f2f07e 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -137,7 +137,6 @@ struct most_dev { #define to_mdev(d) container_of(d, struct most_dev, iface) #define to_mdev_from_work(w) container_of(w, struct most_dev, poll_work_obj) -static struct workqueue_struct *schedule_usb_work; static void wq_clear_halt(struct work_struct *wq_obj); static void wq_netinfo(struct work_struct *wq_obj); @@ -226,6 +225,8 @@ static void free_anchored_buffers(struct most_dev *mdev, unsigned int channel) kfree(anchor); } spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags); + + cancel_work_sync(&anchor->clear_work_obj); } /** @@ -411,7 +412,7 @@ static void hdm_write_completion(struct urb *urb) mbo->status = MBO_E_INVAL; usb_unlink_urb(urb); INIT_WORK(&anchor->clear_work_obj, wq_clear_halt); - queue_work(schedule_usb_work, &anchor->clear_work_obj); + schedule_work(&anchor->clear_work_obj); return; case -ENODEV: case -EPROTO: @@ -575,7 +576,7 @@ static void hdm_read_completion(struct urb *urb) mbo->status = MBO_E_INVAL; usb_unlink_urb(urb); INIT_WORK(&anchor->clear_work_obj, wq_clear_halt); - queue_work(schedule_usb_work, &anchor->clear_work_obj); + schedule_work(&anchor->clear_work_obj); return; case -ENODEV: case -EPROTO: @@ -872,7 +873,7 @@ static void link_stat_timer_handler(unsigned long data) { struct most_dev *mdev = (struct most_dev *)data; - queue_work(schedule_usb_work, &mdev->poll_work_obj); + schedule_work(&mdev->poll_work_obj); mdev->link_stat_timer.expires = jiffies + (2 * HZ); add_timer(&mdev->link_stat_timer); } @@ -1415,19 +1416,13 @@ static int __init hdm_usb_init(void) pr_err("could not register hdm_usb driver\n"); return -EIO; } - schedule_usb_work = create_workqueue("hdmu_work"); - if (!schedule_usb_work) { - pr_err("could not create workqueue\n"); - usb_deregister(&hdm_usb); - return -ENOMEM; - } + return 0; } static void __exit hdm_usb_exit(void) { pr_info("hdm_usb_exit()\n"); - destroy_workqueue(schedule_usb_work); usb_deregister(&hdm_usb); } |