From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Sathya Prakash <sathya.prakash@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Subject: [PATCH v2 02/18] scsi: mptfusion: Simplify the alloc*_workqueue() invocations
Date: Fri, 16 Aug 2024 14:55:25 -0700 [thread overview]
Message-ID: <20240816215605.36240-3-bvanassche@acm.org> (raw)
In-Reply-To: <20240816215605.36240-1-bvanassche@acm.org>
Let alloc*_workqueue() format the workqueue names instead of calling
snprintf() explicitly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/message/fusion/mptbase.c | 10 +++-------
drivers/message/fusion/mptbase.h | 3 ---
drivers/message/fusion/mptfc.c | 7 ++-----
3 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 4bf669c55649..738bc4e60a18 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1856,10 +1856,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
/* Initialize workqueue */
INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work);
- snprintf(ioc->reset_work_q_name, MPT_KOBJ_NAME_LEN,
- "mpt_poll_%d", ioc->id);
- ioc->reset_work_q = alloc_workqueue(ioc->reset_work_q_name,
- WQ_MEM_RECLAIM, 0);
+ ioc->reset_work_q =
+ alloc_workqueue("mpt_poll_%d", WQ_MEM_RECLAIM, 0, ioc->id);
if (!ioc->reset_work_q) {
printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
ioc->name);
@@ -1986,9 +1984,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
INIT_LIST_HEAD(&ioc->fw_event_list);
spin_lock_init(&ioc->fw_event_lock);
- snprintf(ioc->fw_event_q_name, MPT_KOBJ_NAME_LEN, "mpt/%d", ioc->id);
- ioc->fw_event_q = alloc_workqueue(ioc->fw_event_q_name,
- WQ_MEM_RECLAIM, 0);
+ ioc->fw_event_q = alloc_workqueue("mpt/%d", WQ_MEM_RECLAIM, 0, ioc->id);
if (!ioc->fw_event_q) {
printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n",
ioc->name);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 8031173c3655..b406fd676da0 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -729,7 +729,6 @@ typedef struct _MPT_ADAPTER
struct list_head fw_event_list;
spinlock_t fw_event_lock;
u8 fw_events_off; /* if '1', then ignore events */
- char fw_event_q_name[MPT_KOBJ_NAME_LEN];
struct mutex sas_discovery_mutex;
u8 sas_discovery_runtime;
@@ -764,7 +763,6 @@ typedef struct _MPT_ADAPTER
u8 fc_link_speed[2];
spinlock_t fc_rescan_work_lock;
struct work_struct fc_rescan_work;
- char fc_rescan_work_q_name[MPT_KOBJ_NAME_LEN];
struct workqueue_struct *fc_rescan_work_q;
/* driver forced bus resets count */
@@ -778,7 +776,6 @@ typedef struct _MPT_ADAPTER
spinlock_t scsi_lookup_lock;
u64 dma_mask;
u32 broadcast_aen_busy;
- char reset_work_q_name[MPT_KOBJ_NAME_LEN];
struct workqueue_struct *reset_work_q;
struct delayed_work fault_reset_work;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index a3c17c4fe69c..91242f26defb 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -1349,11 +1349,8 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* initialize workqueue */
- snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name),
- "mptfc_wq_%d", sh->host_no);
- ioc->fc_rescan_work_q =
- alloc_ordered_workqueue(ioc->fc_rescan_work_q_name,
- WQ_MEM_RECLAIM);
+ ioc->fc_rescan_work_q = alloc_ordered_workqueue(
+ "mptfc_wq_%d", WQ_MEM_RECLAIM, sh->host_no);
if (!ioc->fc_rescan_work_q) {
error = -ENOMEM;
goto out_mptfc_host;
next prev parent reply other threads:[~2024-08-16 21:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 21:55 [PATCH v2 00/18] Simplify multiple create*_workqueue() invocations Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 01/18] scsi: Expand all " Bart Van Assche
2024-08-18 23:25 ` Damien Le Moal
2024-08-19 17:17 ` Bart Van Assche
2024-08-19 23:15 ` Damien Le Moal
2024-08-20 5:59 ` Peter Wang (王信友)
2024-08-16 21:55 ` Bart Van Assche [this message]
2024-08-18 23:51 ` [PATCH v2 02/18] scsi: mptfusion: Simplify the alloc*_workqueue() invocations Damien Le Moal
2024-08-19 17:08 ` Bart Van Assche
2024-08-19 23:05 ` Damien Le Moal
2024-08-16 21:55 ` [PATCH v2 03/18] scsi: be2iscsi: Simplify an alloc_workqueue() invocation Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 04/18] scsi: bfa: Simplify an alloc_ordered_workqueue() invocation Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 05/18] scsi: esas2r: " Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 06/18] scsi: fcoe: Simplify alloc_ordered_workqueue() invocations Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 07/18] scsi: ibmvscsi_tgt: Simplify an alloc_workqueue() invocation Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 08/18] scsi: mpi3mr: Simplify an alloc_ordered_workqueue() invocation Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 09/18] scsi: mpt3sas: " Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 10/18] scsi: myrb: " Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 11/18] scsi: myrs: " Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 12/18] scsi: qedf: Simplify alloc_workqueue() invocations Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 13/18] scsi: qedi: Simplify an alloc_workqueue() invocation Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 14/18] scsi: snic: Simplify alloc_workqueue() invocations Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 15/18] scsi: scsi_transport_fc: " Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 16/18] scsi: stex: Simplify an alloc_ordered_workqueue() invocation Bart Van Assche
2024-08-16 21:55 ` [PATCH v2 17/18] scsi: ufs: Simplify alloc*_workqueue() invocation Bart Van Assche
2024-08-17 1:53 ` Manivannan Sadhasivam
2024-08-20 6:00 ` Peter Wang (王信友)
2024-08-16 21:55 ` [PATCH v2 18/18] scsi: core: Simplify an alloc_workqueue() invocation Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816215605.36240-3-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sathya.prakash@broadcom.com \
--cc=sreekanth.reddy@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox