RDMA: Remove redundant 'flush_workqueue()' calls
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 10 Oct 2021 14:08:10 +0000 (16:08 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 12 Oct 2021 16:21:23 +0000 (13:21 -0300)
'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);

Link: https://lore.kernel.org/r/ca7bac6e6c9c5cc8d04eec3944edb13de0e381a3.1633874776.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/sa_query.c
drivers/infiniband/hw/cxgb4/cm.c
drivers/infiniband/hw/cxgb4/device.c
drivers/infiniband/hw/mlx4/alias_GUID.c
drivers/infiniband/sw/siw/siw_cm.c
drivers/infiniband/ulp/ipoib/ipoib_main.c

index a20b8108e160c5f25c4fb9cd27dd0a0a216d0b5d..4220a545387f37daaa3198530036c8764eb114cb 100644 (file)
@@ -2261,7 +2261,6 @@ err1:
 void ib_sa_cleanup(void)
 {
        cancel_delayed_work(&ib_nl_timed_work);
-       flush_workqueue(ib_nl_wq);
        destroy_workqueue(ib_nl_wq);
        mcast_cleanup();
        ib_unregister_client(&sa_client);
index 291471d12197faed012d45f6bc2ad71333e8b2ae..913f39ee44161a48750ecbf2ed4e4b48b959e859 100644 (file)
@@ -4464,6 +4464,5 @@ int __init c4iw_cm_init(void)
 void c4iw_cm_term(void)
 {
        WARN_ON(!list_empty(&timeout_list));
-       flush_workqueue(workq);
        destroy_workqueue(workq);
 }
index 541dbcf22d0ebf78aec4a979336bacc7357600bb..80970a1738f8a674b5a538470d2d0c4cc8e0c7a6 100644 (file)
@@ -1562,7 +1562,6 @@ static void __exit c4iw_exit_module(void)
                kfree(ctx);
        }
        mutex_unlock(&dev_mutex);
-       flush_workqueue(reg_workq);
        destroy_workqueue(reg_workq);
        cxgb4_unregister_uld(CXGB4_ULD_RDMA);
        c4iw_cm_term();
index 571d9c542024c2b9aa6f5181eaafa5ee0d65fb37..e2e1f5daddc40765272ddbca1669871f3864044b 100644 (file)
@@ -822,10 +822,8 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
                }
                spin_unlock_irqrestore(&sriov->alias_guid.ag_work_lock, flags);
        }
-       for (i = 0 ; i < dev->num_ports; i++) {
-               flush_workqueue(dev->sriov.alias_guid.ports_guid[i].wq);
+       for (i = 0 ; i < dev->num_ports; i++)
                destroy_workqueue(dev->sriov.alias_guid.ports_guid[i].wq);
-       }
        ib_sa_unregister_client(dev->sriov.alias_guid.sa_client);
        kfree(dev->sriov.alias_guid.sa_client);
 }
index 7a5ed86ffc9f94f30369797d8cb3fe7ddf4b6972..7acdd3c3a599d05161d4ed64c3581d0e2dd20f20 100644 (file)
@@ -1951,8 +1951,6 @@ int siw_cm_init(void)
 
 void siw_cm_exit(void)
 {
-       if (siw_cm_wq) {
-               flush_workqueue(siw_cm_wq);
+       if (siw_cm_wq)
                destroy_workqueue(siw_cm_wq);
-       }
 }
index 0aa8629fdf62e2de43dd928cb97228ed1a6d3663..9c9da5aa592a69a926e6c5101d4463ad6c4817f8 100644 (file)
@@ -1997,7 +1997,6 @@ static void ipoib_ndo_uninit(struct net_device *dev)
        if (priv->wq) {
                /* See ipoib_mcast_carrier_on_task() */
                WARN_ON(test_bit(IPOIB_FLAG_OPER_UP, &priv->flags));
-               flush_workqueue(priv->wq);
                destroy_workqueue(priv->wq);
                priv->wq = NULL;
        }