Skip to content

Commit 70302fc

Browse files
Merge patch series "Simplify multiple create*_workqueue() invocations"
Bart Van Assche <[email protected]> says: Hi Martin, Multiple SCSI drivers use snprintf() to format a workqueue name before invoking one of the create*_workqueue() macros. This patch series simplifies such code by passing the format string and arguments to alloc_workqueue(). Additionally, the structure members that are only used as a temporary buffer for formatting workqueue names are removed. Please consider this patch series for the next merge window. Thanks, Bart. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 3c9265e + ba52850 commit 70302fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+90
-142
lines changed

drivers/message/fusion/mptbase.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,10 +1856,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
18561856
/* Initialize workqueue */
18571857
INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work);
18581858

1859-
snprintf(ioc->reset_work_q_name, MPT_KOBJ_NAME_LEN,
1860-
"mpt_poll_%d", ioc->id);
1861-
ioc->reset_work_q = alloc_workqueue(ioc->reset_work_q_name,
1862-
WQ_MEM_RECLAIM, 0);
1859+
ioc->reset_work_q =
1860+
alloc_workqueue("mpt_poll_%d", WQ_MEM_RECLAIM, 0, ioc->id);
18631861
if (!ioc->reset_work_q) {
18641862
printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
18651863
ioc->name);
@@ -1986,9 +1984,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
19861984

19871985
INIT_LIST_HEAD(&ioc->fw_event_list);
19881986
spin_lock_init(&ioc->fw_event_lock);
1989-
snprintf(ioc->fw_event_q_name, MPT_KOBJ_NAME_LEN, "mpt/%d", ioc->id);
1990-
ioc->fw_event_q = alloc_workqueue(ioc->fw_event_q_name,
1991-
WQ_MEM_RECLAIM, 0);
1987+
ioc->fw_event_q = alloc_workqueue("mpt/%d", WQ_MEM_RECLAIM, 0, ioc->id);
19921988
if (!ioc->fw_event_q) {
19931989
printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
19941990
ioc->name);

drivers/message/fusion/mptbase.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,6 @@ typedef struct _MPT_ADAPTER
729729
struct list_head fw_event_list;
730730
spinlock_t fw_event_lock;
731731
u8 fw_events_off; /* if '1', then ignore events */
732-
char fw_event_q_name[MPT_KOBJ_NAME_LEN];
733732

734733
struct mutex sas_discovery_mutex;
735734
u8 sas_discovery_runtime;
@@ -764,7 +763,6 @@ typedef struct _MPT_ADAPTER
764763
u8 fc_link_speed[2];
765764
spinlock_t fc_rescan_work_lock;
766765
struct work_struct fc_rescan_work;
767-
char fc_rescan_work_q_name[MPT_KOBJ_NAME_LEN];
768766
struct workqueue_struct *fc_rescan_work_q;
769767

770768
/* driver forced bus resets count */
@@ -778,7 +776,6 @@ typedef struct _MPT_ADAPTER
778776
spinlock_t scsi_lookup_lock;
779777
u64 dma_mask;
780778
u32 broadcast_aen_busy;
781-
char reset_work_q_name[MPT_KOBJ_NAME_LEN];
782779
struct workqueue_struct *reset_work_q;
783780
struct delayed_work fault_reset_work;
784781

drivers/message/fusion/mptfc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,11 +1349,8 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13491349

13501350
/* initialize workqueue */
13511351

1352-
snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name),
1353-
"mptfc_wq_%d", sh->host_no);
1354-
ioc->fc_rescan_work_q =
1355-
alloc_ordered_workqueue(ioc->fc_rescan_work_q_name,
1356-
WQ_MEM_RECLAIM);
1352+
ioc->fc_rescan_work_q = alloc_ordered_workqueue(
1353+
"mptfc_wq_%d", WQ_MEM_RECLAIM, sh->host_no);
13571354
if (!ioc->fc_rescan_work_q) {
13581355
error = -ENOMEM;
13591356
goto out_mptfc_host;

drivers/scsi/be2iscsi/be_main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5528,7 +5528,6 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
55285528
struct beiscsi_hba *phba = NULL;
55295529
struct be_eq_obj *pbe_eq;
55305530
unsigned int s_handle;
5531-
char wq_name[20];
55325531
int ret, i;
55335532

55345533
ret = beiscsi_enable_pci(pcidev);
@@ -5634,9 +5633,8 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
56345633

56355634
phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0;
56365635

5637-
snprintf(wq_name, sizeof(wq_name), "beiscsi_%02x_wq",
5638-
phba->shost->host_no);
5639-
phba->wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, wq_name);
5636+
phba->wq = alloc_workqueue("beiscsi_%02x_wq", WQ_MEM_RECLAIM, 1,
5637+
phba->shost->host_no);
56405638
if (!phba->wq) {
56415639
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
56425640
"BM_%d : beiscsi_dev_probe-"

drivers/scsi/bfa/bfad_im.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,8 @@ bfad_thread_workq(struct bfad_s *bfad)
766766
struct bfad_im_s *im = bfad->im;
767767

768768
bfa_trc(bfad, 0);
769-
snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d",
770-
bfad->inst_no);
771-
im->drv_workq = create_singlethread_workqueue(im->drv_workq_name);
769+
im->drv_workq = alloc_ordered_workqueue("bfad_wq_%d", WQ_MEM_RECLAIM,
770+
bfad->inst_no);
772771
if (!im->drv_workq)
773772
return BFA_STATUS_FAILED;
774773

drivers/scsi/bfa/bfad_im.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ struct bfad_fcp_binding {
134134
struct bfad_im_s {
135135
struct bfad_s *bfad;
136136
struct workqueue_struct *drv_workq;
137-
char drv_workq_name[KOBJ_NAME_LEN];
138137
struct work_struct aen_im_notify_work;
139138
};
140139

drivers/scsi/bnx2fc/bnx2fc_fcoe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,8 +2363,8 @@ static int _bnx2fc_create(struct net_device *netdev,
23632363
interface->vlan_id = vlan_id;
23642364
interface->tm_timeout = BNX2FC_TM_TIMEOUT;
23652365

2366-
interface->timer_work_queue =
2367-
create_singlethread_workqueue("bnx2fc_timer_wq");
2366+
interface->timer_work_queue = alloc_ordered_workqueue(
2367+
"%s", WQ_MEM_RECLAIM, "bnx2fc_timer_wq");
23682368
if (!interface->timer_work_queue) {
23692369
printk(KERN_ERR PFX "ulp_init could not create timer_wq\n");
23702370
rc = -EINVAL;

drivers/scsi/device_handler/scsi_dh_rdac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ static int __init rdac_init(void)
822822
/*
823823
* Create workqueue to handle mode selects for rdac
824824
*/
825-
kmpath_rdacd = create_singlethread_workqueue("kmpath_rdacd");
825+
kmpath_rdacd =
826+
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "kmpath_rdacd");
826827
if (!kmpath_rdacd) {
827828
scsi_unregister_device_handler(&rdac_dh);
828829
printk(KERN_ERR "kmpath_rdacd creation failed.\n");

drivers/scsi/elx/efct/efct_lio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,8 @@ int efct_scsi_tgt_new_device(struct efct *efct)
11141114
atomic_set(&efct->tgt_efct.watermark_hit, 0);
11151115
atomic_set(&efct->tgt_efct.initiator_count, 0);
11161116

1117-
lio_wq = create_singlethread_workqueue("efct_lio_worker");
1117+
lio_wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
1118+
"efct_lio_worker");
11181119
if (!lio_wq) {
11191120
efc_log_err(efct, "workqueue create failed\n");
11201121
return -EIO;

drivers/scsi/esas2r/esas2r.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,6 @@ struct esas2r_adapter {
929929
struct list_head fw_event_list;
930930
spinlock_t fw_event_lock;
931931
u8 fw_events_off; /* if '1', then ignore events */
932-
char fw_event_q_name[ESAS2R_KOBJ_NAME_LEN];
933932
/*
934933
* intr_mode stores the interrupt mode currently being used by this
935934
* adapter. it is based on the interrupt_mode module parameter, but

0 commit comments

Comments
 (0)