Commit f057a1d4 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

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: default avatarShuah Khan <skhan@linuxfoundation.org>
Acked-by: Peter Chen <peter.chen@kernel.or> # for chipidea part
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/563123a8117d6cafae3f134e497587bd2b8bb7f4.1636734453.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c76ef96f
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -255,10 +255,9 @@ int ci_hdrc_otg_init(struct ci_hdrc *ci)
 */
 */
void ci_hdrc_otg_destroy(struct ci_hdrc *ci)
void ci_hdrc_otg_destroy(struct ci_hdrc *ci)
{
{
	if (ci->wq) {
	if (ci->wq)
		flush_workqueue(ci->wq);
		destroy_workqueue(ci->wq);
		destroy_workqueue(ci->wq);
	}

	/* Disable all OTG irq and clear status */
	/* Disable all OTG irq and clear status */
	hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS,
	hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS,
						OTGSC_INT_STATUS_BITS);
						OTGSC_INT_STATUS_BITS);
+1 −3
Original line number Original line Diff line number Diff line
@@ -2084,10 +2084,8 @@ static int mv_udc_remove(struct platform_device *pdev)


	usb_del_gadget_udc(&udc->gadget);
	usb_del_gadget_udc(&udc->gadget);


	if (udc->qwork) {
	if (udc->qwork)
		flush_workqueue(udc->qwork);
		destroy_workqueue(udc->qwork);
		destroy_workqueue(udc->qwork);
	}


	/* free memory allocated in probe */
	/* free memory allocated in probe */
	dma_pool_destroy(udc->dtd_pool);
	dma_pool_destroy(udc->dtd_pool);
+0 −1
Original line number Original line Diff line number Diff line
@@ -3211,7 +3211,6 @@ static void __exit u132_hcd_exit(void)
	platform_driver_unregister(&u132_platform_driver);
	platform_driver_unregister(&u132_platform_driver);
	printk(KERN_INFO "u132-hcd driver deregistered\n");
	printk(KERN_INFO "u132-hcd driver deregistered\n");
	wait_event(u132_hcd_wait, u132_instances == 0);
	wait_event(u132_hcd_wait, u132_instances == 0);
	flush_workqueue(workqueue);
	destroy_workqueue(workqueue);
	destroy_workqueue(workqueue);
}
}


+1 −4
Original line number Original line Diff line number Diff line
@@ -648,10 +648,8 @@ static int mv_otg_remove(struct platform_device *pdev)
{
{
	struct mv_otg *mvotg = platform_get_drvdata(pdev);
	struct mv_otg *mvotg = platform_get_drvdata(pdev);


	if (mvotg->qwork) {
	if (mvotg->qwork)
		flush_workqueue(mvotg->qwork);
		destroy_workqueue(mvotg->qwork);
		destroy_workqueue(mvotg->qwork);
	}


	mv_otg_disable(mvotg);
	mv_otg_disable(mvotg);


@@ -825,7 +823,6 @@ static int mv_otg_probe(struct platform_device *pdev)
err_disable_clk:
err_disable_clk:
	mv_otg_disable_internal(mvotg);
	mv_otg_disable_internal(mvotg);
err_destroy_workqueue:
err_destroy_workqueue:
	flush_workqueue(mvotg->qwork);
	destroy_workqueue(mvotg->qwork);
	destroy_workqueue(mvotg->qwork);


	return retval;
	return retval;
+0 −1
Original line number Original line Diff line number Diff line
@@ -137,7 +137,6 @@ int usbip_init_eh(void)


void usbip_finish_eh(void)
void usbip_finish_eh(void)
{
{
	flush_workqueue(usbip_queue);
	destroy_workqueue(usbip_queue);
	destroy_workqueue(usbip_queue);
	usbip_queue = NULL;
	usbip_queue = NULL;
}
}