Skip to contentSkip to conversation

zfcp: simplify workqueue allocation

PATCH New Nihar Panda 2 participants 5 messages May 7, 2025 – May 21, 2025

Subsystems (3)
lore
Share & tools
lore

Nihar Panda

author maintainer
#0 lore raw

Hello James, Martin,
we have a small zfcp bugfix.
It would be nice, if you could still include them v6.15-rc5 merge window

author maintainer
#1 lore raw

cover zfcp: simplify workqueue allocation

alloc_ordered_workqueue() accepts a format string and format arguments as part of the call, so there is no need for the indirection of first using snprintf() to print the name into an local array, and then passing that array to the allocation call.

Benjamin Block (1):
zfcp: simplify workqueue allocation

 drivers/s390/scsi/zfcp_aux.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

base-commit: 20b97acc4cafa2be8ac91a777de135110e58a90b

Signature · 1 line
2.45.2
author maintainer
#2 lore raw

PATCH 1/1 zfcp: simplify workqueue allocation

In reply to Nihar Panda

From: Benjamin Block <[email protected]>

alloc_ordered_workqueue() accepts a format string and format arguments as part of the call, so there is no need for the indirection of first using snprintf() to print the name into an local array, and then passing that array to the allocation call.

Also make the error-/non-error-case handling more canonical in that the error case is tested in the if that follows the allocation call, and the default return value of the function is 0.

---
 drivers/s390/scsi/zfcp_aux.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/s390/scsi/zfcp_aux.c +6 -8
index 22074e81bd38..dc2265ebb11b 100644
@@ -312,15 +312,13 @@ static void zfcp_print_sl(struct seq_file *m, struct service_level *sl)
 
 static int zfcp_setup_adapter_work_queue(struct zfcp_adapter *adapter)
 {
-	char name[TASK_COMM_LEN];
-
-	snprintf(name, sizeof(name), "zfcp_q_%s",
-		 dev_name(&adapter->ccw_device->dev));
-	adapter->work_queue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
+	adapter->work_queue =
+		alloc_ordered_workqueue("zfcp_q_%s", WQ_MEM_RECLAIM,
+					dev_name(&adapter->ccw_device->dev));
+	if (!adapter->work_queue)
+		return -ENOMEM;
 
-	if (adapter->work_queue)
-		return 0;
-	return -ENOMEM;
+	return 0;
 }
 
 static void zfcp_destroy_adapter_work_queue(struct zfcp_adapter *adapter)

base-commit: e142de4aac2aae697d7e977b01e7a889e9f454df

Signature · 1 line
2.45.2
#3 lore raw

Nihar,

Quoted 4 lines

alloc_ordered_workqueue() accepts a format string and format arguments as part of the call, so there is no need for the indirection of first using snprintf() to print the name into an local array, and then passing that array to the allocation call.

Applied to 6.16/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen
#4 lore raw
In reply to Nihar Panda
Quoted 10 lines · Nihar Panda

alloc_ordered_workqueue() accepts a format string and format arguments as part of the call, so there is no need for the indirection of first using snprintf() to print the name into an local array, and then passing that array to the allocation call.

Also make the error-/non-error-case handling more canonical in that the error case is tested in the if that follows the allocation call, and the default return value of the function is 0.

[...]

Applied to 6.16/scsi-queue, thanks!

[1/1] zfcp: simplify workqueue allocation

      https://git.kernel.org/mkp/scsi/c/769d7fbe01f6
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering