Skip to content

Commit dec5239

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: mptfusion: Simplify the alloc*_workqueue() invocations
Let alloc*_workqueue() format the workqueue names 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 b97c074 commit dec5239

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
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;

0 commit comments

Comments
 (0)