Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: Remove redundant 'flush_workqueue()' calls

'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

This was generated with coccinelle:

@@
expression E;
@@
- flush_workqueue(E);
destroy_workqueue(E);

Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Peter Chen <peter.chen@kernel.or> # for chipidea part
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/563123a8117d6cafae3f134e497587bd2b8bb7f4.1636734453.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
f057a1d4 c76ef96f

+4 -12
+2 -3
drivers/usb/chipidea/otg.c
··· 255 255 */ 256 256 void ci_hdrc_otg_destroy(struct ci_hdrc *ci) 257 257 { 258 - if (ci->wq) { 259 - flush_workqueue(ci->wq); 258 + if (ci->wq) 260 259 destroy_workqueue(ci->wq); 261 - } 260 + 262 261 /* Disable all OTG irq and clear status */ 263 262 hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS, 264 263 OTGSC_INT_STATUS_BITS);
+1 -3
drivers/usb/gadget/udc/mv_udc_core.c
··· 2084 2084 2085 2085 usb_del_gadget_udc(&udc->gadget); 2086 2086 2087 - if (udc->qwork) { 2088 - flush_workqueue(udc->qwork); 2087 + if (udc->qwork) 2089 2088 destroy_workqueue(udc->qwork); 2090 - } 2091 2089 2092 2090 /* free memory allocated in probe */ 2093 2091 dma_pool_destroy(udc->dtd_pool);
-1
drivers/usb/host/u132-hcd.c
··· 3211 3211 platform_driver_unregister(&u132_platform_driver); 3212 3212 printk(KERN_INFO "u132-hcd driver deregistered\n"); 3213 3213 wait_event(u132_hcd_wait, u132_instances == 0); 3214 - flush_workqueue(workqueue); 3215 3214 destroy_workqueue(workqueue); 3216 3215 } 3217 3216
+1 -4
drivers/usb/phy/phy-mv-usb.c
··· 648 648 { 649 649 struct mv_otg *mvotg = platform_get_drvdata(pdev); 650 650 651 - if (mvotg->qwork) { 652 - flush_workqueue(mvotg->qwork); 651 + if (mvotg->qwork) 653 652 destroy_workqueue(mvotg->qwork); 654 - } 655 653 656 654 mv_otg_disable(mvotg); 657 655 ··· 823 825 err_disable_clk: 824 826 mv_otg_disable_internal(mvotg); 825 827 err_destroy_workqueue: 826 - flush_workqueue(mvotg->qwork); 827 828 destroy_workqueue(mvotg->qwork); 828 829 829 830 return retval;
-1
drivers/usb/usbip/usbip_event.c
··· 137 137 138 138 void usbip_finish_eh(void) 139 139 { 140 - flush_workqueue(usbip_queue); 141 140 destroy_workqueue(usbip_queue); 142 141 usbip_queue = NULL; 143 142 }