Commit 70302fc7 authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

Merge patch series "Simplify multiple create*_workqueue() invocations"

Bart Van Assche <bvanassche@acm.org> 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/20240822195944.654691-1-bvanassche@acm.org


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 3c9265ed ba52850c
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -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);
+0 −3
Original line number Diff line number Diff line
@@ -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;

+2 −5
Original line number Diff line number Diff line
@@ -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;
+2 −4
Original line number Diff line number Diff line
@@ -5528,7 +5528,6 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
	struct beiscsi_hba *phba = NULL;
	struct be_eq_obj *pbe_eq;
	unsigned int s_handle;
	char wq_name[20];
	int ret, i;

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

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

	snprintf(wq_name, sizeof(wq_name), "beiscsi_%02x_wq",
	phba->wq = alloc_workqueue("beiscsi_%02x_wq", WQ_MEM_RECLAIM, 1,
				   phba->shost->host_no);
	phba->wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, wq_name);
	if (!phba->wq) {
		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
			    "BM_%d : beiscsi_dev_probe-"
+2 −3
Original line number Diff line number Diff line
@@ -766,9 +766,8 @@ bfad_thread_workq(struct bfad_s *bfad)
	struct bfad_im_s      *im = bfad->im;

	bfa_trc(bfad, 0);
	snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d",
	im->drv_workq = alloc_ordered_workqueue("bfad_wq_%d", WQ_MEM_RECLAIM,
						bfad->inst_no);
	im->drv_workq = create_singlethread_workqueue(im->drv_workq_name);
	if (!im->drv_workq)
		return BFA_STATUS_FAILED;

Loading