public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls
@ 2025-03-12  7:43 Chen Ni
  2025-03-12 18:24 ` Karan Tilak Kumar (kartilak)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chen Ni @ 2025-03-12  7:43 UTC (permalink / raw)
  To: satishkh, sebaddel, kartilak, James.Bottomley, martin.petersen,
	linux-scsi, linux-kernel
  Cc: Chen Ni

'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);

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/scsi/fnic/fnic_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 0b20ac8c3f46..3dd06376e97b 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -1365,10 +1365,9 @@ static void __exit fnic_cleanup_module(void)
 	if (pc_rscn_handling_feature_flag == PC_RSCN_HANDLING_FEATURE_ON)
 		destroy_workqueue(reset_fnic_work_queue);
 
-	if (fnic_fip_queue) {
-		flush_workqueue(fnic_fip_queue);
+	if (fnic_fip_queue)
 		destroy_workqueue(fnic_fip_queue);
-	}
+
 	kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_MAX]);
 	kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]);
 	kmem_cache_destroy(fnic_io_req_cache);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls
  2025-03-12  7:43 [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls Chen Ni
@ 2025-03-12 18:24 ` Karan Tilak Kumar (kartilak)
  2025-03-18  1:22 ` Martin K. Petersen
  2025-03-21  0:36 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Karan Tilak Kumar (kartilak) @ 2025-03-12 18:24 UTC (permalink / raw)
  To: Chen Ni, Satish Kharat (satishkh), Sesidhar Baddela (sebaddel),
	James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

On Wednesday, March 12, 2025 12:43 AM, Chen Ni <nichen@iscas.ac.cn> wrote:
>
> '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);
>
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/scsi/fnic/fnic_main.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
> index 0b20ac8c3f46..3dd06376e97b 100644
> --- a/drivers/scsi/fnic/fnic_main.c
> +++ b/drivers/scsi/fnic/fnic_main.c
> @@ -1365,10 +1365,9 @@ static void __exit fnic_cleanup_module(void)
> if (pc_rscn_handling_feature_flag == PC_RSCN_HANDLING_FEATURE_ON)
> destroy_workqueue(reset_fnic_work_queue);
>
> -     if (fnic_fip_queue) {
> -             flush_workqueue(fnic_fip_queue);
> +     if (fnic_fip_queue)
> destroy_workqueue(fnic_fip_queue);
> -     }
> +
> kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_MAX]);
> kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]);
> kmem_cache_destroy(fnic_io_req_cache);
> --
> 2.25.1
>
>

Looks good to me.
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>

Regards,
Karan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls
  2025-03-12  7:43 [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls Chen Ni
  2025-03-12 18:24 ` Karan Tilak Kumar (kartilak)
@ 2025-03-18  1:22 ` Martin K. Petersen
  2025-03-21  0:36 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-03-18  1:22 UTC (permalink / raw)
  To: Chen Ni
  Cc: satishkh, sebaddel, kartilak, James.Bottomley, martin.petersen,
	linux-scsi, linux-kernel


Chen,

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

Applied to 6.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls
  2025-03-12  7:43 [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls Chen Ni
  2025-03-12 18:24 ` Karan Tilak Kumar (kartilak)
  2025-03-18  1:22 ` Martin K. Petersen
@ 2025-03-21  0:36 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-03-21  0:36 UTC (permalink / raw)
  To: satishkh, sebaddel, kartilak, James.Bottomley, linux-scsi,
	linux-kernel, Chen Ni
  Cc: Martin K . Petersen

On Wed, 12 Mar 2025 15:43:20 +0800, Chen Ni wrote:

> '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:
> 
> [...]

Applied to 6.15/scsi-queue, thanks!

[1/1] scsi: fnic: Remove redundant 'flush_workqueue()' calls
      https://git.kernel.org/mkp/scsi/c/160d6ec69f40

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-21  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12  7:43 [PATCH] scsi: fnic: Remove redundant 'flush_workqueue()' calls Chen Ni
2025-03-12 18:24 ` Karan Tilak Kumar (kartilak)
2025-03-18  1:22 ` Martin K. Petersen
2025-03-21  0:36 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox