Skip to content

Commit 06d5378

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: scsi_transport_fc: Simplify alloc_workqueue() invocations
Let alloc_workqueue() format the workqueue name instead of calling snprintf() explicitly. Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6411307 commit 06d5378

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

drivers/scsi/scsi_transport_fc.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,13 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
441441
fc_host->next_vport_number = 0;
442442
fc_host->npiv_vports_inuse = 0;
443443

444-
snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name),
445-
"fc_wq_%d", shost->host_no);
446-
fc_host->work_q = alloc_workqueue("%s", 0, 0, fc_host->work_q_name);
444+
fc_host->work_q = alloc_workqueue("fc_wq_%d", 0, 0, shost->host_no);
447445
if (!fc_host->work_q)
448446
return -ENOMEM;
449447

450448
fc_host->dev_loss_tmo = fc_dev_loss_tmo;
451-
snprintf(fc_host->devloss_work_q_name,
452-
sizeof(fc_host->devloss_work_q_name),
453-
"fc_dl_%d", shost->host_no);
454-
fc_host->devloss_work_q = alloc_workqueue("%s", 0, 0,
455-
fc_host->devloss_work_q_name);
449+
fc_host->devloss_work_q = alloc_workqueue("fc_dl_%d", 0, 0,
450+
shost->host_no);
456451
if (!fc_host->devloss_work_q) {
457452
destroy_workqueue(fc_host->work_q);
458453
fc_host->work_q = NULL;

include/scsi/scsi_transport_fc.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,7 @@ struct fc_host_attrs {
575575
u16 npiv_vports_inuse;
576576

577577
/* work queues for rport state manipulation */
578-
char work_q_name[20];
579578
struct workqueue_struct *work_q;
580-
char devloss_work_q_name[20];
581579
struct workqueue_struct *devloss_work_q;
582580

583581
/* bsg support */
@@ -654,12 +652,8 @@ struct fc_host_attrs {
654652
(((struct fc_host_attrs *)(x)->shost_data)->next_vport_number)
655653
#define fc_host_npiv_vports_inuse(x) \
656654
(((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse)
657-
#define fc_host_work_q_name(x) \
658-
(((struct fc_host_attrs *)(x)->shost_data)->work_q_name)
659655
#define fc_host_work_q(x) \
660656
(((struct fc_host_attrs *)(x)->shost_data)->work_q)
661-
#define fc_host_devloss_work_q_name(x) \
662-
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name)
663657
#define fc_host_devloss_work_q(x) \
664658
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
665659
#define fc_host_dev_loss_tmo(x) \

0 commit comments

Comments
 (0)