public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/53] Let create*_workqueue() accept a printf-style format string
@ 2024-06-30 22:26 Bart Van Assche
  2024-06-30 22:26 ` [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros Bart Van Assche
                   ` (52 more replies)
  0 siblings, 53 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche

Hi Tejun,

A significant amount of kernel code formats the workqueue name before it
calls a workqueue creation function. This patch series simplifies such kernel
code and modifies the create*_workqueue() macros such that these accept a
printf-style format string and argument list.

The approach of this patch series is as follows:
1. Introduce the create*_workqueue2() macros that accept a printf-style
   format string and argument list.
2. Convert all workqueue creation calls that might pass a name that includes
   a formatting character from create*_workqueue(name) into
   create*_workqueue2("%s", name).
3. Convert all workqueue creation code that is preceded by workqueue name
   formatting code into a create*_workqueue2(fmt, args) call.
4. Convert all create*_workqueue2() calls into create*_workqueue() calls,
   remove the original create*_workqueue() calls and rename the new
   create*_workqueue2() macros into create*_workqueue().

Please consider this patch series for the next merge window.

Thanks,

Bart.

Bart Van Assche (53):
  workqueue: Introduce the create*_workqueue2() macros
  dmaengine: idxd: Switch to create*_workqueue2()
  drm/amdgpu: Switch to create*_workqueue2()
  media: i2c: adv7511: Switch to create*_workqueue2()
  media: cobalt: Switch to create*_workqueue2()
  media: dm1105: Switch to create*_workqueue2()
  misc: bcm_vk: Switch to create*_workqueue2()
  net: amd-xgbe: Switch to create*_workqueue2()
  net: atlantic: Switch to create*_workqueue2()
  net: mvpp2: Switch to create*_workqueue2()
  remoteproc: stm32: Switch to create*_workqueue2()
  mm/z3fold: Switch to create*_workqueue2()
  usb: typec: tcpm: Switch to create*_workqueue2()
  net/qla3xxx: Switch to create*_workqueue2()
  sfc: Switch to create*_workqueue2()
  wifi: zd1211rw: Switch to create*_workqueue2()
  power: supply: mt6370: Switch to create*_workqueue2()
  remoteproc: imx_rproc: Switch to create*_workqueue2()
  scsi: hisi_sas: Switch to create*_workqueue2()
  scsi: mpt3sas: Switch to create*_workqueue2()
  accel/habanalabs: Simplify the workqueue creation calls
  crypto: safexcel - Simplify a create*_workqueue() call
  pds_core: Simplify a create*_workqueue() call
  net: bna: Simplify a create*_workqueue() call
  net/mlx5: Simplify the create*_workqueue() calls
  net: lan966x: Simplify a create*_workqueue() call
  net: sparx5: Simplify the create*_workqueue() calls
  net: mscc: ocelot: Simplify a create*_workqueue() call
  net: qed: Simplify a create*_workqueue() call
  net: stmmac: Simplify a create*_workqueue() call
  nfc: mrvl: Simplify a create*_workqueue() call
  scsi: ibmvscsi_tgt: Simplify a create*_workqueue() call
  scsi: libsas: Simplify the create*_workqueue() calls
  scsi: mpi3mr: Simplify a create*_workqueue() call
  scsi: qedf: Simplify the create*_workqueue() calls
  scsi: qedi: Simplify the create*_workqueue() calls
  scsi: qla2xxx: Simplify the create*_workqueue() calls
  scsi: qla4xxx: Simplify a create*_workqueue() call
  scsi: vmw_pvscsi: Simplify a create*_workqueue() call
  scsi: myrb: Simplify the create*_workqueue() calls
  scsi: myrs: Simplify the create*_workqueue() calls
  scsi: stex: Simplify the create*_workqueue() calls
  scsi: fcoe: Simplify the create*_workqueue() calls
  scsi: snic: Simplify the create*_workqueue() calls
  scsi: scsi_transport_fc: Simplify the create*_workqueue() calls
  scsi: core: Simplify the alloc_workqueue() calls
  serial: max3100: Simplify a create*_workqueue() call
  scsi: ufs: Simplify the create*_workqueue() calls
  usb: typec: ucsi: Simplify a create*_workqueue() call
  cifs: Simplify a create*_workqueue() call
  mac802154: Simplify the create*_workqueue() calls
  nfc: nci: Simplify the create*_workqueue() calls
  workqueue: Rename create*_workqueue2() into create*_workqueue()

 drivers/accel/habanalabs/common/device.c      | 25 +++++++++----------
 drivers/crypto/inside-secure/safexcel.c       |  4 +--
 drivers/dma/idxd/cdev.c                       |  2 +-
 drivers/dma/idxd/init.c                       |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c     |  2 +-
 drivers/media/i2c/adv7511-v4l2.c              |  2 +-
 drivers/media/pci/cobalt/cobalt-driver.c      |  2 +-
 drivers/media/pci/dm1105/dm1105.c             |  2 +-
 drivers/misc/bcm-vk/bcm_vk_dev.c              |  2 +-
 drivers/net/ethernet/amd/pds_core/main.c      |  7 ++----
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c      |  4 +--
 .../net/ethernet/aquantia/atlantic/aq_main.c  |  2 +-
 drivers/net/ethernet/brocade/bna/bnad.c       |  4 +--
 drivers/net/ethernet/brocade/bna/bnad.h       |  1 -
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  3 ++-
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 12 ++-------
 .../net/ethernet/mellanox/mlx5/core/health.c  | 10 ++------
 .../mellanox/mlx5/core/sf/vhca_event.c        |  5 ++--
 .../microchip/lan966x/lan966x_ethtool.c       |  7 ++----
 .../microchip/sparx5/sparx5_ethtool.c         |  6 ++---
 .../ethernet/microchip/sparx5/sparx5_main.c   |  6 ++---
 drivers/net/ethernet/mscc/ocelot_stats.c      |  6 ++---
 drivers/net/ethernet/qlogic/qed/qed_sriov.c   |  9 +++----
 drivers/net/ethernet/qlogic/qla3xxx.c         |  2 +-
 drivers/net/ethernet/sfc/efx_common.c         |  3 ++-
 drivers/net/ethernet/sfc/falcon/efx.c         |  3 ++-
 drivers/net/ethernet/sfc/siena/efx_common.c   |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++-----
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c  |  2 +-
 drivers/nfc/nfcmrvl/fw_dnld.c                 |  8 +++---
 drivers/power/supply/mt6370-charger.c         |  2 +-
 drivers/remoteproc/imx_rproc.c                |  2 +-
 drivers/remoteproc/stm32_rproc.c              |  2 +-
 drivers/scsi/fcoe/fcoe_sysfs.c                |  7 +-----
 drivers/scsi/hisi_sas/hisi_sas_main.c         |  2 +-
 drivers/scsi/hosts.c                          |  9 +++----
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c      |  4 +--
 drivers/scsi/libsas/sas_init.c                |  9 +++----
 drivers/scsi/mpi3mr/mpi3mr_fw.c               |  4 +--
 drivers/scsi/mpt3sas/mpt3sas_base.c           |  4 +--
 drivers/scsi/myrb.c                           |  5 ++--
 drivers/scsi/myrb.h                           |  1 -
 drivers/scsi/myrs.c                           |  5 ++--
 drivers/scsi/myrs.h                           |  1 -
 drivers/scsi/qedf/qedf_main.c                 | 17 +++++--------
 drivers/scsi/qedi/qedi_main.c                 |  8 +++---
 drivers/scsi/qla2xxx/qla_os.c                 | 10 ++++----
 drivers/scsi/qla4xxx/ql4_os.c                 |  5 ++--
 drivers/scsi/scsi_transport_fc.c              |  4 +--
 drivers/scsi/snic/snic_main.c                 |  5 ++--
 drivers/scsi/stex.c                           |  6 ++---
 drivers/scsi/vmw_pvscsi.c                     |  8 ++----
 drivers/tty/serial/max3100.c                  |  4 +--
 drivers/ufs/core/ufshcd.c                     | 13 +++-------
 drivers/usb/typec/tcpm/fusb302.c              |  2 +-
 drivers/usb/typec/ucsi/ucsi.c                 |  9 ++-----
 fs/smb/client/smbdirect.c                     |  3 +--
 include/linux/mlx5/driver.h                   |  5 ----
 include/linux/workqueue.h                     | 15 +++++------
 include/scsi/fcoe_sysfs.h                     |  1 -
 include/scsi/scsi_host.h                      |  1 -
 include/scsi/scsi_transport_fc.h              |  3 ---
 mm/z3fold.c                                   |  4 +--
 net/mac802154/main.c                          |  7 +++---
 net/nfc/nci/core.c                            | 13 +++++-----
 66 files changed, 135 insertions(+), 223 deletions(-)


^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-07-01  2:51   ` Lai Jiangshan
  2024-06-30 22:26 ` [PATCH 02/53] dmaengine: idxd: Switch to create*_workqueue2() Bart Van Assche
                   ` (51 subsequent siblings)
  52 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche

A common pattern in the Linux kernel is that sprintf(), snprintf() or
kasprintf() is used to format the workqueue name that is passed to
create_workqueue(), create_freezable_workqueue() or
create_singlethread_workqueue(). Prepare for simplifying such code by
introducing the create*_workqueue2() macros that accept a printf-style
format string and argument list. A later patch will remove the
create*_workqueue() macros and will rename the create*_workqueue2()
macros into create*_workqueue().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/workqueue.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index d9968bfc8eac..762aaedaba56 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -525,11 +525,20 @@ alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...);
 
 #define create_workqueue(name)						\
 	alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))
+#define create_workqueue2(fmt, args...) \
+	alloc_workqueue(fmt, __WQ_LEGACY | WQ_MEM_RECLAIM, 1, ##args)
 #define create_freezable_workqueue(name)				\
 	alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND |	\
 			WQ_MEM_RECLAIM, 1, (name))
+#define create_freezable_workqueue2(fmt, args...)                               \
+	alloc_workqueue(                                                       \
+		fmt, __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \
+		1, ##args)
 #define create_singlethread_workqueue(name)				\
 	alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, name)
+#define create_singlethread_workqueue2(fmt, args...)			\
+	alloc_ordered_workqueue(fmt, __WQ_LEGACY | WQ_MEM_RECLAIM, ##args)
+
 
 #define from_work(var, callback_work, work_fieldname)	\
 	container_of(callback_work, typeof(*var), work_fieldname)

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 02/53] dmaengine: idxd: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
  2024-06-30 22:26 ` [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 03/53] drm/amdgpu: " Bart Van Assche
                   ` (50 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Fenghua Yu, Vinod Koul

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/dma/idxd/cdev.c | 2 +-
 drivers/dma/idxd/init.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
index 57f1bf2ab20b..5aef47e5c6e4 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -619,7 +619,7 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
 		goto wq_err;
 	}
 
-	wq->wq = create_workqueue(dev_name(wq_confdev(wq)));
+	wq->wq = create_workqueue2("%s", dev_name(wq_confdev(wq)));
 	if (!wq->wq) {
 		rc = -ENOMEM;
 		goto wq_err;
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index a7295943fa22..a3e821090bf2 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -397,7 +397,7 @@ static int idxd_setup_internals(struct idxd_device *idxd)
 	if (rc < 0)
 		goto err_group;
 
-	idxd->wq = create_workqueue(dev_name(dev));
+	idxd->wq = create_workqueue2("%s", dev_name(dev));
 	if (!idxd->wq) {
 		rc = -ENOMEM;
 		goto err_wkq_create;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 03/53] drm/amdgpu: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
  2024-06-30 22:26 ` [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros Bart Van Assche
  2024-06-30 22:26 ` [PATCH 02/53] dmaengine: idxd: Switch to create*_workqueue2() Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 04/53] media: i2c: adv7511: " Bart Van Assche
                   ` (49 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Sunil Khatri, Shashank Sharma, Lijo Lazar,
	André Almeida, Srinivasan Shanmugam

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
index ea4873f6ccd1..6ed3af1286fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
@@ -131,7 +131,7 @@ struct amdgpu_reset_domain *amdgpu_reset_create_reset_domain(enum amdgpu_reset_d
 	reset_domain->type = type;
 	kref_init(&reset_domain->refcount);
 
-	reset_domain->wq = create_singlethread_workqueue(wq_name);
+	reset_domain->wq = create_singlethread_workqueue2("%s", wq_name);
 	if (!reset_domain->wq) {
 		DRM_ERROR("Failed to allocate wq for amdgpu_reset_domain!");
 		amdgpu_reset_put_reset_domain(reset_domain);

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 04/53] media: i2c: adv7511: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (2 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 03/53] drm/amdgpu: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 05/53] media: cobalt: " Bart Van Assche
                   ` (48 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Hans Verkuil, Mauro Carvalho Chehab

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/media/i2c/adv7511-v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c
index 79946e9c7401..88e065a65ac1 100644
--- a/drivers/media/i2c/adv7511-v4l2.c
+++ b/drivers/media/i2c/adv7511-v4l2.c
@@ -1885,7 +1885,7 @@ static int adv7511_probe(struct i2c_client *client)
 		goto err_unreg_cec;
 	}
 
-	state->work_queue = create_singlethread_workqueue(sd->name);
+	state->work_queue = create_singlethread_workqueue2("%s", sd->name);
 	if (state->work_queue == NULL) {
 		v4l2_err(sd, "could not create workqueue\n");
 		err = -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 05/53] media: cobalt: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (3 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 04/53] media: i2c: adv7511: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 06/53] media: dm1105: " Bart Van Assche
                   ` (47 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Hans Verkuil, Mauro Carvalho Chehab

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/media/pci/cobalt/cobalt-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c
index 6e1a0614e6d0..24e8f4439c53 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.c
+++ b/drivers/media/pci/cobalt/cobalt-driver.c
@@ -683,7 +683,7 @@ static int cobalt_probe(struct pci_dev *pci_dev,
 	cobalt_info("Initializing card %d\n", cobalt->instance);
 
 	cobalt->irq_work_queues =
-		create_singlethread_workqueue(cobalt->v4l2_dev.name);
+		create_singlethread_workqueue2("%s", cobalt->v4l2_dev.name);
 	if (cobalt->irq_work_queues == NULL) {
 		cobalt_err("Could not create workqueue\n");
 		retval = -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 06/53] media: dm1105: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (4 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 05/53] media: cobalt: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 07/53] misc: bcm_vk: " Bart Van Assche
                   ` (46 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Mauro Carvalho Chehab

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/media/pci/dm1105/dm1105.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c
index 9e9c7c071acc..05959891aa5f 100644
--- a/drivers/media/pci/dm1105/dm1105.c
+++ b/drivers/media/pci/dm1105/dm1105.c
@@ -1123,7 +1123,7 @@ static int dm1105_probe(struct pci_dev *pdev,
 
 	INIT_WORK(&dev->work, dm1105_dmx_buffer);
 	sprintf(dev->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num);
-	dev->wq = create_singlethread_workqueue(dev->wqn);
+	dev->wq = create_singlethread_workqueue2("%s", dev->wqn);
 	if (!dev->wq) {
 		ret = -ENOMEM;
 		goto err_dvb_net;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 07/53] misc: bcm_vk: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (5 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 06/53] media: dm1105: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 08/53] net: amd-xgbe: " Bart Van Assche
                   ` (45 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Scott Branden, Arnd Bergmann, Greg Kroah-Hartman

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/misc/bcm-vk/bcm_vk_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c
index d4a96137728d..ced5c9f17909 100644
--- a/drivers/misc/bcm-vk/bcm_vk_dev.c
+++ b/drivers/misc/bcm-vk/bcm_vk_dev.c
@@ -1428,7 +1428,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	INIT_WORK(&vk->wq_work, bcm_vk_wq_handler);
 
 	/* create dedicated workqueue */
-	vk->wq_thread = create_singlethread_workqueue(name);
+	vk->wq_thread = create_singlethread_workqueue2("%s", name);
 	if (!vk->wq_thread) {
 		dev_err(dev, "Fail to create workqueue thread\n");
 		err = -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 08/53] net: amd-xgbe: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (6 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 07/53] misc: bcm_vk: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 09/53] net: atlantic: " Bart Van Assche
                   ` (44 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Shyam Sundar S K, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index c4a4e316683f..20281f0381be 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1846,14 +1846,14 @@ static int xgbe_open(struct net_device *netdev)
 
 	/* Create workqueues */
 	pdata->dev_workqueue =
-		create_singlethread_workqueue(netdev_name(netdev));
+		create_singlethread_workqueue2("%s", netdev_name(netdev));
 	if (!pdata->dev_workqueue) {
 		netdev_err(netdev, "device workqueue creation failed\n");
 		return -ENOMEM;
 	}
 
 	pdata->an_workqueue =
-		create_singlethread_workqueue(pdata->an_name);
+		create_singlethread_workqueue2("%s", pdata->an_name);
 	if (!pdata->an_workqueue) {
 		netdev_err(netdev, "phy workqueue creation failed\n");
 		ret = -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 09/53] net: atlantic: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (7 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 08/53] net: amd-xgbe: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 10/53] net: mvpp2: " Bart Van Assche
                   ` (43 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Igor Russkikh, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index c1d1673c5749..606ec93ba429 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
@@ -513,7 +513,7 @@ static int __init aq_ndev_init_module(void)
 {
 	int ret;
 
-	aq_ndev_wq = create_singlethread_workqueue(aq_ndev_driver_name);
+	aq_ndev_wq = create_singlethread_workqueue2("%s", aq_ndev_driver_name);
 	if (!aq_ndev_wq) {
 		pr_err("Failed to create workqueue\n");
 		return -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 10/53] net: mvpp2: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (8 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 09/53] net: atlantic: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 11/53] remoteproc: stm32: " Bart Van Assche
                   ` (42 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Marcin Wojtas, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 9adf4301c9b1..58b104d2f24c 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -7635,7 +7635,8 @@ static int mvpp2_probe(struct platform_device *pdev)
 	snprintf(priv->queue_name, sizeof(priv->queue_name),
 		 "stats-wq-%s%s", netdev_name(priv->port_list[0]->dev),
 		 priv->port_count > 1 ? "+" : "");
-	priv->stats_queue = create_singlethread_workqueue(priv->queue_name);
+	priv->stats_queue =
+		create_singlethread_workqueue2("%s", priv->queue_name);
 	if (!priv->stats_queue) {
 		err = -ENOMEM;
 		goto err_port_probe;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 11/53] remoteproc: stm32: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (9 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 10/53] net: mvpp2: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 12/53] mm/z3fold: " Bart Van Assche
                   ` (41 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Bjorn Andersson, Mathieu Poirier, Maxime Coquelin,
	Alexandre Torgue

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/remoteproc/stm32_rproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
index 88623df7d0c3..5af6fdc6881c 100644
--- a/drivers/remoteproc/stm32_rproc.c
+++ b/drivers/remoteproc/stm32_rproc.c
@@ -867,7 +867,7 @@ static int stm32_rproc_probe(struct platform_device *pdev)
 		rproc->state = RPROC_DETACHED;
 
 	rproc->has_iommu = false;
-	ddata->workqueue = create_workqueue(dev_name(dev));
+	ddata->workqueue = create_workqueue2("%s", dev_name(dev));
 	if (!ddata->workqueue) {
 		dev_err(dev, "cannot create workqueue\n");
 		ret = -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 12/53] mm/z3fold: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (10 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 11/53] remoteproc: stm32: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 13/53] usb: typec: tcpm: " Bart Van Assche
                   ` (40 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Vitaly Wool, Andrew Morton

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 mm/z3fold.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index 2ebfed32871b..6fd3a05ecfc6 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -934,10 +934,10 @@ static struct z3fold_pool *z3fold_create_pool(const char *name, gfp_t gfp)
 	INIT_LIST_HEAD(&pool->stale);
 	atomic64_set(&pool->pages_nr, 0);
 	pool->name = name;
-	pool->compact_wq = create_singlethread_workqueue(pool->name);
+	pool->compact_wq = create_singlethread_workqueue2("%s", pool->name);
 	if (!pool->compact_wq)
 		goto out_unbuddied;
-	pool->release_wq = create_singlethread_workqueue(pool->name);
+	pool->release_wq = create_singlethread_workqueue2("%s", pool->name);
 	if (!pool->release_wq)
 		goto out_wq;
 	INIT_WORK(&pool->work, free_pages_work);

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 13/53] usb: typec: tcpm: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (11 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 12/53] mm/z3fold: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 14/53] net/qla3xxx: " Bart Van Assche
                   ` (39 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Heikki Krogerus, Greg Kroah-Hartman, Rob Herring, Herve Codina,
	RD Babiera

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/usb/typec/tcpm/fusb302.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index ef18a448b740..894e5f6bba60 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -1715,7 +1715,7 @@ static int fusb302_probe(struct i2c_client *client)
 	if (IS_ERR(chip->vbus))
 		return PTR_ERR(chip->vbus);
 
-	chip->wq = create_singlethread_workqueue(dev_name(chip->dev));
+	chip->wq = create_singlethread_workqueue2("%s", dev_name(chip->dev));
 	if (!chip->wq)
 		return -ENOMEM;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 14/53] net/qla3xxx: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (12 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 13/53] usb: typec: tcpm: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 15/53] sfc: " Bart Van Assche
                   ` (38 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	GR-Linux-NIC-Dev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index fc78bc959ded..5912679bd2f0 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -3862,7 +3862,7 @@ static int ql3xxx_probe(struct pci_dev *pdev,
 	netif_carrier_off(ndev);
 	netif_stop_queue(ndev);
 
-	qdev->workqueue = create_singlethread_workqueue(ndev->name);
+	qdev->workqueue = create_singlethread_workqueue2("%s", ndev->name);
 	if (!qdev->workqueue) {
 		unregister_netdev(ndev);
 		err = -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 15/53] sfc: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (13 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 14/53] net/qla3xxx: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 16/53] wifi: zd1211rw: " Bart Van Assche
                   ` (37 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Edward Cree, Martin Habets, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shannon Nelson, Jacob Keller,
	Simon Horman

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/sfc/efx_common.c       | 3 ++-
 drivers/net/ethernet/sfc/falcon/efx.c       | 3 ++-
 drivers/net/ethernet/sfc/siena/efx_common.c | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c
index 4ebd5ae23eca..6dc068d2c295 100644
--- a/drivers/net/ethernet/sfc/efx_common.c
+++ b/drivers/net/ethernet/sfc/efx_common.c
@@ -1035,7 +1035,8 @@ int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev)
 	/* Would be good to use the net_dev name, but we're too early */
 	snprintf(efx->workqueue_name, sizeof(efx->workqueue_name), "sfc%s",
 		 pci_name(pci_dev));
-	efx->workqueue = create_singlethread_workqueue(efx->workqueue_name);
+	efx->workqueue =
+		create_singlethread_workqueue2("%s", efx->workqueue_name);
 	if (!efx->workqueue) {
 		rc = -ENOMEM;
 		goto fail;
diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c
index 8925745f1c17..d4d02e2438c6 100644
--- a/drivers/net/ethernet/sfc/falcon/efx.c
+++ b/drivers/net/ethernet/sfc/falcon/efx.c
@@ -2671,7 +2671,8 @@ static int ef4_init_struct(struct ef4_nic *efx,
 	/* Would be good to use the net_dev name, but we're too early */
 	snprintf(efx->workqueue_name, sizeof(efx->workqueue_name), "sfc%s",
 		 pci_name(pci_dev));
-	efx->workqueue = create_singlethread_workqueue(efx->workqueue_name);
+	efx->workqueue =
+		create_singlethread_workqueue2("%s", efx->workqueue_name);
 	if (!efx->workqueue)
 		goto fail;
 
diff --git a/drivers/net/ethernet/sfc/siena/efx_common.c b/drivers/net/ethernet/sfc/siena/efx_common.c
index cf195162e270..1a1448a75d99 100644
--- a/drivers/net/ethernet/sfc/siena/efx_common.c
+++ b/drivers/net/ethernet/sfc/siena/efx_common.c
@@ -1050,7 +1050,8 @@ int efx_siena_init_struct(struct efx_nic *efx,
 	/* Would be good to use the net_dev name, but we're too early */
 	snprintf(efx->workqueue_name, sizeof(efx->workqueue_name), "sfc%s",
 		 pci_name(pci_dev));
-	efx->workqueue = create_singlethread_workqueue(efx->workqueue_name);
+	efx->workqueue =
+		create_singlethread_workqueue2("%s", efx->workqueue_name);
 	if (!efx->workqueue) {
 		rc = -ENOMEM;
 		goto fail;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 16/53] wifi: zd1211rw: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (14 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 15/53] sfc: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 17/53] power: supply: mt6370: " Bart Van Assche
                   ` (36 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Kalle Valo, Yueh-Shun Li, Johannes Berg

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
index f3b567a13ded..54501732cd91 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
@@ -1542,7 +1542,7 @@ static int __init usb_init(void)
 
 	pr_debug("%s usb_init()\n", driver.name);
 
-	zd_workqueue = create_singlethread_workqueue(driver.name);
+	zd_workqueue = create_singlethread_workqueue2("%s", driver.name);
 	if (zd_workqueue == NULL) {
 		pr_err("%s couldn't create workqueue\n", driver.name);
 		return -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 17/53] power: supply: mt6370: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (15 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 16/53] wifi: zd1211rw: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 18/53] remoteproc: imx_rproc: " Bart Van Assche
                   ` (35 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Sebastian Reichel, Matthias Brugger, AngeloGioacchino Del Regno

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/power/supply/mt6370-charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/mt6370-charger.c b/drivers/power/supply/mt6370-charger.c
index e24fce087d80..8843da4dda92 100644
--- a/drivers/power/supply/mt6370-charger.c
+++ b/drivers/power/supply/mt6370-charger.c
@@ -908,7 +908,7 @@ static int mt6370_chg_probe(struct platform_device *pdev)
 
 	priv->attach = MT6370_ATTACH_STAT_DETACH;
 
-	priv->wq = create_singlethread_workqueue(dev_name(priv->dev));
+	priv->wq = create_singlethread_workqueue2("%s", dev_name(priv->dev));
 	if (!priv->wq)
 		return dev_err_probe(dev, -ENOMEM,
 				     "Failed to create workqueue\n");

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 18/53] remoteproc: imx_rproc: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (16 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 17/53] power: supply: mt6370: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 19/53] scsi: hisi_sas: " Bart Van Assche
                   ` (34 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer

Prepare for removal of the create*_workqueue() macros.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/remoteproc/imx_rproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 5a3fb902acc9..14fe2aca50c4 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -1064,7 +1064,7 @@ static int imx_rproc_probe(struct platform_device *pdev)
 	priv->dev = dev;
 
 	dev_set_drvdata(dev, rproc);
-	priv->workqueue = create_workqueue(dev_name(dev));
+	priv->workqueue = create_workqueue("%s", dev_name(dev));
 	if (!priv->workqueue) {
 		dev_err(dev, "cannot create workqueue\n");
 		return -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 19/53] scsi: hisi_sas: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (17 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 18/53] remoteproc: imx_rproc: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 20/53] scsi: mpt3sas: " Bart Van Assche
                   ` (33 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Xiang Chen, James E.J. Bottomley

Prepare for removal of the create*_workqueue() macros.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index ec1a3e7ee94d..ba6f20baf6ae 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2302,7 +2302,7 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba)
 
 	hisi_hba->last_slot_index = 0;
 
-	hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));
+	hisi_hba->wq = create_singlethread_workqueue2("%s", dev_name(dev));
 	if (!hisi_hba->wq) {
 		dev_err(dev, "sas_alloc: failed to create workqueue\n");
 		goto err_out;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 20/53] scsi: mpt3sas: Switch to create*_workqueue2()
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (18 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 19/53] scsi: hisi_sas: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 21/53] accel/habanalabs: Simplify the workqueue creation calls Bart Van Assche
                   ` (32 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani,
	James E.J. Bottomley

Prepare for removal of the create*_workqueue() macros.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index b2bcf4a27ddc..2d8a56309ef0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -846,8 +846,8 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc)
 	snprintf(ioc->fault_reset_work_q_name,
 	    sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
 	    ioc->driver_name, ioc->id);
-	ioc->fault_reset_work_q =
-		create_singlethread_workqueue(ioc->fault_reset_work_q_name);
+	ioc->fault_reset_work_q = create_singlethread_workqueue2(
+		"%s", ioc->fault_reset_work_q_name);
 	if (!ioc->fault_reset_work_q) {
 		ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__);
 		return;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 21/53] accel/habanalabs: Simplify the workqueue creation calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (19 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 20/53] scsi: mpt3sas: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 22/53] crypto: safexcel - Simplify a create*_workqueue() call Bart Van Assche
                   ` (31 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Oded Gabbay, Tomer Tayar, Farah Kassabri, Ofir Bitton, Koby Elbaz,
	Dafna Hirschfeld, Ohad Sharabi, Dani Liberman

Pass a format string to the workqueue creation calls instead of formatting
the workqueue name before a workqueue creation macro is used.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/accel/habanalabs/common/device.c | 25 ++++++++++++------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index 8f92445c5a90..e44c8352c1da 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -831,7 +831,6 @@ static void device_release_watchdog_func(struct work_struct *work)
 static int device_early_init(struct hl_device *hdev)
 {
 	int i, rc;
-	char workq_name[32];
 
 	switch (hdev->asic_type) {
 	case ASIC_GOYA:
@@ -883,8 +882,8 @@ static int device_early_init(struct hl_device *hdev)
 	}
 
 	for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
-		snprintf(workq_name, 32, "hl%u-free-jobs-%u", hdev->cdev_idx, (u32) i);
-		hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
+		hdev->cq_wq[i] = create_singlethread_workqueue2(
+			"hl%u-free-jobs-%u", hdev->cdev_idx, i);
 		if (hdev->cq_wq[i] == NULL) {
 			dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
 			rc = -ENOMEM;
@@ -892,16 +891,16 @@ static int device_early_init(struct hl_device *hdev)
 		}
 	}
 
-	snprintf(workq_name, 32, "hl%u-events", hdev->cdev_idx);
-	hdev->eq_wq = create_singlethread_workqueue(workq_name);
+	hdev->eq_wq =
+		create_singlethread_workqueue2("hl%u-events", hdev->cdev_idx);
 	if (hdev->eq_wq == NULL) {
 		dev_err(hdev->dev, "Failed to allocate EQ workqueue\n");
 		rc = -ENOMEM;
 		goto free_cq_wq;
 	}
 
-	snprintf(workq_name, 32, "hl%u-cs-completions", hdev->cdev_idx);
-	hdev->cs_cmplt_wq = alloc_workqueue(workq_name, WQ_UNBOUND, 0);
+	hdev->cs_cmplt_wq = alloc_workqueue("hl%u-cs-completions", WQ_UNBOUND,
+					    0, hdev->cdev_idx);
 	if (!hdev->cs_cmplt_wq) {
 		dev_err(hdev->dev,
 			"Failed to allocate CS completions workqueue\n");
@@ -909,8 +908,8 @@ static int device_early_init(struct hl_device *hdev)
 		goto free_eq_wq;
 	}
 
-	snprintf(workq_name, 32, "hl%u-ts-free-obj", hdev->cdev_idx);
-	hdev->ts_free_obj_wq = alloc_workqueue(workq_name, WQ_UNBOUND, 0);
+	hdev->ts_free_obj_wq = alloc_workqueue("hl%u-ts-free-obj", WQ_UNBOUND,
+					       0, hdev->cdev_idx);
 	if (!hdev->ts_free_obj_wq) {
 		dev_err(hdev->dev,
 			"Failed to allocate Timestamp registration free workqueue\n");
@@ -918,8 +917,8 @@ static int device_early_init(struct hl_device *hdev)
 		goto free_cs_cmplt_wq;
 	}
 
-	snprintf(workq_name, 32, "hl%u-prefetch", hdev->cdev_idx);
-	hdev->prefetch_wq = alloc_workqueue(workq_name, WQ_UNBOUND, 0);
+	hdev->prefetch_wq =
+		alloc_workqueue("hl%u-prefetch", WQ_UNBOUND, 0, hdev->cdev_idx);
 	if (!hdev->prefetch_wq) {
 		dev_err(hdev->dev, "Failed to allocate MMU prefetch workqueue\n");
 		rc = -ENOMEM;
@@ -938,8 +937,8 @@ static int device_early_init(struct hl_device *hdev)
 
 	hl_mem_mgr_init(hdev->dev, &hdev->kernel_mem_mgr);
 
-	snprintf(workq_name, 32, "hl%u_device_reset", hdev->cdev_idx);
-	hdev->reset_wq = create_singlethread_workqueue(workq_name);
+	hdev->reset_wq = create_singlethread_workqueue2("hl%u_device_reset",
+							hdev->cdev_idx);
 	if (!hdev->reset_wq) {
 		rc = -ENOMEM;
 		dev_err(hdev->dev, "Failed to create device reset WQ\n");

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 22/53] crypto: safexcel - Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (20 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 21/53] accel/habanalabs: Simplify the workqueue creation calls Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 23/53] pds_core: " Bart Van Assche
                   ` (30 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Antoine Tenart, Herbert Xu, David S. Miller

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/crypto/inside-secure/safexcel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index f5c1912aa564..45cff3adc71d 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -1615,7 +1615,6 @@ static int safexcel_probe_generic(void *pdev,
 		return -ENOMEM;
 
 	for (i = 0; i < priv->config.rings; i++) {
-		char wq_name[9] = {0};
 		int irq;
 		struct safexcel_ring_irq_data *ring_irq;
 
@@ -1664,9 +1663,8 @@ static int safexcel_probe_generic(void *pdev,
 		INIT_WORK(&priv->ring[i].work_data.work,
 			  safexcel_dequeue_work);
 
-		snprintf(wq_name, 9, "wq_ring%d", i);
 		priv->ring[i].workqueue =
-			create_singlethread_workqueue(wq_name);
+			create_singlethread_workqueue2("wq_ring%d", i);
 		if (!priv->ring[i].workqueue) {
 			ret = -ENOMEM;
 			goto err_cleanup_rings;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 23/53] pds_core: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (21 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 22/53] crypto: safexcel - Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-07-01 18:49   ` Brett Creeley
  2024-06-30 22:26 ` [PATCH 24/53] net: bna: " Bart Van Assche
                   ` (29 subsequent siblings)
  52 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Shannon Nelson, Brett Creeley, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/amd/pds_core/main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/amd/pds_core/main.c b/drivers/net/ethernet/amd/pds_core/main.c
index 660268ff9562..e2e49656c111 100644
--- a/drivers/net/ethernet/amd/pds_core/main.c
+++ b/drivers/net/ethernet/amd/pds_core/main.c
@@ -213,12 +213,9 @@ static const struct devlink_param pdsc_dl_params[] = {
 			      pdsc_dl_enable_validate),
 };
 
-#define PDSC_WQ_NAME_LEN 24
-
 static int pdsc_init_pf(struct pdsc *pdsc)
 {
 	struct devlink_health_reporter *hr;
-	char wq_name[PDSC_WQ_NAME_LEN];
 	struct devlink *dl;
 	int err;
 
@@ -236,8 +233,8 @@ static int pdsc_init_pf(struct pdsc *pdsc)
 		goto err_out_release_regions;
 
 	/* General workqueue and timer, but don't start timer yet */
-	snprintf(wq_name, sizeof(wq_name), "%s.%d", PDS_CORE_DRV_NAME, pdsc->uid);
-	pdsc->wq = create_singlethread_workqueue(wq_name);
+	pdsc->wq = create_singlethread_workqueue2("%s.%d", PDS_CORE_DRV_NAME,
+						  pdsc->uid);
 	INIT_WORK(&pdsc->health_work, pdsc_health_thread);
 	INIT_WORK(&pdsc->pci_reset_work, pdsc_pci_reset_thread);
 	timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 24/53] net: bna: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (22 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 23/53] pds_core: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 25/53] net/mlx5: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (28 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Rasesh Mody, Sudarsana Kalluru, GR-Linux-NIC-Dev, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/brocade/bna/bnad.c | 4 ++--
 drivers/net/ethernet/brocade/bna/bnad.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index fe121d36112d..7d482e8b0949 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -3488,8 +3488,8 @@ bnad_init(struct bnad *bnad,
 	bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO;
 	bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO;
 
-	sprintf(bnad->wq_name, "%s_wq_%d", BNAD_NAME, bnad->id);
-	bnad->work_q = create_singlethread_workqueue(bnad->wq_name);
+	bnad->work_q =
+		create_singlethread_workqueue2("%s_wq_%d", BNAD_NAME, bnad->id);
 	if (!bnad->work_q) {
 		iounmap(bnad->bar0);
 		return -ENOMEM;
diff --git a/drivers/net/ethernet/brocade/bna/bnad.h b/drivers/net/ethernet/brocade/bna/bnad.h
index 10b1e534030e..0d70b1df1793 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.h
+++ b/drivers/net/ethernet/brocade/bna/bnad.h
@@ -346,7 +346,6 @@ struct bnad {
 	char			adapter_name[BNAD_NAME_LEN];
 	char			port_name[BNAD_NAME_LEN];
 	char			mbox_irq_name[BNAD_NAME_LEN];
-	char			wq_name[BNAD_NAME_LEN];
 
 	/* debugfs specific data */
 	char	*regdata;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 25/53] net/mlx5: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (23 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 24/53] net: bna: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 26/53] net: lan966x: Simplify a create*_workqueue() call Bart Van Assche
                   ` (27 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Saeed Mahameed, Leon Romanovsky, Tariq Toukan, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Wei Zhang,
	Jacob Keller, Shay Drory

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c        | 12 ++----------
 drivers/net/ethernet/mellanox/mlx5/core/health.c     | 10 ++--------
 .../net/ethernet/mellanox/mlx5/core/sf/vhca_event.c  |  5 ++---
 include/linux/mlx5/driver.h                          |  5 -----
 4 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 20768ef2e9d2..bbc7d0f2fd40 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -1560,14 +1560,6 @@ static const struct file_operations olfops = {
 	.read	= outlen_read,
 };
 
-static void set_wqname(struct mlx5_core_dev *dev)
-{
-	struct mlx5_cmd *cmd = &dev->cmd;
-
-	snprintf(cmd->wq_name, sizeof(cmd->wq_name), "mlx5_cmd_%s",
-		 dev_name(dev->device));
-}
-
 static void clean_debug_files(struct mlx5_core_dev *dev)
 {
 	struct mlx5_cmd_debug *dbg = &dev->cmd.dbg;
@@ -2292,8 +2284,8 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
 	spin_lock_init(&cmd->alloc_lock);
 	spin_lock_init(&cmd->token_lock);
 
-	set_wqname(dev);
-	cmd->wq = create_singlethread_workqueue(cmd->wq_name);
+	cmd->wq = create_singlethread_workqueue2("mlx5_cmd_%s",
+						 dev_name(dev->device));
 	if (!cmd->wq) {
 		mlx5_core_err(dev, "failed to create command workqueue\n");
 		return -ENOMEM;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index a6329ca2d9bf..1c46bced73cd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -869,7 +869,6 @@ int mlx5_health_init(struct mlx5_core_dev *dev)
 {
 	struct devlink *devlink = priv_to_devlink(dev);
 	struct mlx5_core_health *health;
-	char *name;
 
 	if (!mlx5_dev_is_lightweight(dev)) {
 		devl_lock(devlink);
@@ -879,14 +878,9 @@ int mlx5_health_init(struct mlx5_core_dev *dev)
 	mlx5_reporter_vnic_create(dev);
 
 	health = &dev->priv.health;
-	name = kmalloc(64, GFP_KERNEL);
-	if (!name)
-		goto out_err;
 
-	strcpy(name, "mlx5_health");
-	strcat(name, dev_name(dev->device));
-	health->wq = create_singlethread_workqueue(name);
-	kfree(name);
+	health->wq = create_singlethread_workqueue2("mlx5_health%s",
+						    dev_name(dev->device));
 	if (!health->wq)
 		goto out_err;
 	INIT_WORK(&health->fatal_report_work, mlx5_fw_fatal_reporter_err_work);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.c
index cda01ba441ae..b761350617df 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.c
@@ -148,7 +148,6 @@ void mlx5_vhca_state_cap_handle(struct mlx5_core_dev *dev, void *set_hca_cap)
 int mlx5_vhca_event_init(struct mlx5_core_dev *dev)
 {
 	struct mlx5_vhca_state_notifier *notifier;
-	char wq_name[MLX5_CMD_WQ_MAX_NAME];
 	struct mlx5_vhca_events *events;
 	int err, i;
 
@@ -162,8 +161,8 @@ int mlx5_vhca_event_init(struct mlx5_core_dev *dev)
 	events->dev = dev;
 	dev->priv.vhca_events = events;
 	for (i = 0; i < MLX5_DEV_MAX_WQS; i++) {
-		snprintf(wq_name, MLX5_CMD_WQ_MAX_NAME, "mlx5_vhca_event%d", i);
-		events->handler[i].wq = create_singlethread_workqueue(wq_name);
+		events->handler[i].wq =
+			create_singlethread_workqueue2("mlx5_vhca_event%d", i);
 		if (!events->handler[i].wq) {
 			err = -ENOMEM;
 			goto err_create_wq;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 779cfdf2e9d6..835b960b9fdc 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -66,10 +66,6 @@ enum {
 	MLX5_BOARD_ID_LEN = 64,
 };
 
-enum {
-	MLX5_CMD_WQ_MAX_NAME	= 32,
-};
-
 enum {
 	CMD_OWNER_SW		= 0x0,
 	CMD_OWNER_HW		= 0x1,
@@ -317,7 +313,6 @@ struct mlx5_cmd {
 	 */
 	spinlock_t	token_lock;
 	u8		token;
-	char		wq_name[MLX5_CMD_WQ_MAX_NAME];
 	struct workqueue_struct *wq;
 	int	mode;
 	u16     allowed_opcode;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 26/53] net: lan966x: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (24 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 25/53] net/mlx5: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 27/53] net: sparx5: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (26 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Horatiu Vultur, UNGLinuxDriver, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c
index 06811c60d598..69e6bb0cc44d 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c
@@ -701,8 +701,6 @@ void lan966x_stats_get(struct net_device *dev,
 
 int lan966x_stats_init(struct lan966x *lan966x)
 {
-	char queue_name[32];
-
 	lan966x->stats_layout = lan966x_stats_layout;
 	lan966x->num_stats = ARRAY_SIZE(lan966x_stats_layout);
 	lan966x->stats = devm_kcalloc(lan966x->dev, lan966x->num_phys_ports *
@@ -713,9 +711,8 @@ int lan966x_stats_init(struct lan966x *lan966x)
 
 	/* Init stats worker */
 	mutex_init(&lan966x->stats_lock);
-	snprintf(queue_name, sizeof(queue_name), "%s-stats",
-		 dev_name(lan966x->dev));
-	lan966x->stats_queue = create_singlethread_workqueue(queue_name);
+	lan966x->stats_queue = create_singlethread_workqueue2(
+		"%s-stats", dev_name(lan966x->dev));
 	if (!lan966x->stats_queue)
 		return -ENOMEM;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 27/53] net: sparx5: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (25 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 26/53] net: lan966x: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 28/53] net: mscc: ocelot: Simplify a create*_workqueue() call Bart Van Assche
                   ` (25 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Lars Povlsen, Steen Hegelund, Daniel Machon, UNGLinuxDriver,
	justinstitt@google.com, Wei Fang, Kees Cook, Louis Peens,
	Horatiu Vultur, Uwe Kleine-König

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c | 6 ++----
 drivers/net/ethernet/microchip/sparx5/sparx5_main.c    | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
index a06dc5a9b355..e15736831747 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
@@ -1231,7 +1231,6 @@ const struct ethtool_ops sparx5_ethtool_ops = {
 
 int sparx_stats_init(struct sparx5 *sparx5)
 {
-	char queue_name[32];
 	int portno;
 
 	sparx5->stats_layout = sparx5_stats_layout;
@@ -1249,9 +1248,8 @@ int sparx_stats_init(struct sparx5 *sparx5)
 		if (sparx5->ports[portno])
 			sparx5_config_port_stats(sparx5, portno);
 
-	snprintf(queue_name, sizeof(queue_name), "%s-stats",
-		 dev_name(sparx5->dev));
-	sparx5->stats_queue = create_singlethread_workqueue(queue_name);
+	sparx5->stats_queue = create_singlethread_workqueue2(
+		"%s-stats", dev_name(sparx5->dev));
 	if (!sparx5->stats_queue)
 		return -ENOMEM;
 
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
index b64c814eac11..39c87e85fb8c 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
@@ -596,7 +596,6 @@ static void sparx5_board_init(struct sparx5 *sparx5)
 static int sparx5_start(struct sparx5 *sparx5)
 {
 	u8 broadcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-	char queue_name[32];
 	u32 idx;
 	int err;
 
@@ -661,9 +660,8 @@ static int sparx5_start(struct sparx5 *sparx5)
 	/* Init mact_sw struct */
 	mutex_init(&sparx5->mact_lock);
 	INIT_LIST_HEAD(&sparx5->mact_entries);
-	snprintf(queue_name, sizeof(queue_name), "%s-mact",
-		 dev_name(sparx5->dev));
-	sparx5->mact_queue = create_singlethread_workqueue(queue_name);
+	sparx5->mact_queue =
+		create_singlethread_workqueue2("%s-mact", dev_name(sparx5->dev));
 	if (!sparx5->mact_queue)
 		return -ENOMEM;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 28/53] net: mscc: ocelot: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (26 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 27/53] net: sparx5: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 29/53] net: qed: " Bart Van Assche
                   ` (24 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/mscc/ocelot_stats.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c
index c018783757fb..55bb6fac6e36 100644
--- a/drivers/net/ethernet/mscc/ocelot_stats.c
+++ b/drivers/net/ethernet/mscc/ocelot_stats.c
@@ -951,7 +951,6 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot)
 
 int ocelot_stats_init(struct ocelot *ocelot)
 {
-	char queue_name[32];
 	int ret;
 
 	ocelot->stats = devm_kcalloc(ocelot->dev,
@@ -960,9 +959,8 @@ int ocelot_stats_init(struct ocelot *ocelot)
 	if (!ocelot->stats)
 		return -ENOMEM;
 
-	snprintf(queue_name, sizeof(queue_name), "%s-stats",
-		 dev_name(ocelot->dev));
-	ocelot->stats_queue = create_singlethread_workqueue(queue_name);
+	ocelot->stats_queue = create_singlethread_workqueue2(
+		"%s-stats", dev_name(ocelot->dev));
 	if (!ocelot->stats_queue)
 		return -ENOMEM;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 29/53] net: qed: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (27 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 28/53] net: mscc: ocelot: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 30/53] net: stmmac: " Bart Van Assche
                   ` (23 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Manish Chopra, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/qlogic/qed/qed_sriov.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
index fa167b1aa019..29c5b301bbd7 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
@@ -5262,7 +5262,6 @@ void qed_iov_wq_stop(struct qed_dev *cdev, bool schedule_first)
 
 int qed_iov_wq_start(struct qed_dev *cdev)
 {
-	char name[NAME_SIZE];
 	int i;
 
 	for_each_hwfn(cdev, i) {
@@ -5274,11 +5273,9 @@ int qed_iov_wq_start(struct qed_dev *cdev)
 		if (IS_PF(p_hwfn->cdev) && !IS_PF_SRIOV(p_hwfn))
 			continue;
 
-		snprintf(name, NAME_SIZE, "iov-%02x:%02x.%02x",
-			 cdev->pdev->bus->number,
-			 PCI_SLOT(cdev->pdev->devfn), p_hwfn->abs_pf_id);
-
-		p_hwfn->iov_wq = create_singlethread_workqueue(name);
+		p_hwfn->iov_wq = create_singlethread_workqueue2(
+			"iov-%02x:%02x.%02x", cdev->pdev->bus->number,
+			PCI_SLOT(cdev->pdev->devfn), p_hwfn->abs_pf_id);
 		if (!p_hwfn->iov_wq) {
 			DP_NOTICE(p_hwfn, "Cannot create iov workqueue\n");
 			return -ENOMEM;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 30/53] net: stmmac: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (28 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 29/53] net: qed: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 31/53] nfc: mrvl: " Bart Van Assche
                   ` (22 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h      |  1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++-------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index b23b920eedb1..b47528ad4fb6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -343,7 +343,6 @@ struct stmmac_priv {
 	unsigned long fpe_task_state;
 	struct workqueue_struct *fpe_wq;
 	struct work_struct fpe_task;
-	char wq_name[IFNAMSIZ + 4];
 
 	/* TC Handling */
 	unsigned int tc_entries_max;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b3afc7cb7d72..42d0e2e630c9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3362,17 +3362,14 @@ static void stmmac_safety_feat_configuration(struct stmmac_priv *priv)
 
 static int stmmac_fpe_start_wq(struct stmmac_priv *priv)
 {
-	char *name;
-
 	clear_bit(__FPE_TASK_SCHED, &priv->fpe_task_state);
 	clear_bit(__FPE_REMOVING,  &priv->fpe_task_state);
 
-	name = priv->wq_name;
-	sprintf(name, "%s-fpe", priv->dev->name);
-
-	priv->fpe_wq = create_singlethread_workqueue(name);
+	priv->fpe_wq =
+		create_singlethread_workqueue2("%s-fpe", priv->dev->name);
 	if (!priv->fpe_wq) {
-		netdev_err(priv->dev, "%s: Failed to create workqueue\n", name);
+		netdev_err(priv->dev, "%s: Failed to create workqueue\n",
+			   __func__);
 
 		return -ENOMEM;
 	}

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 31/53] nfc: mrvl: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (29 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 30/53] net: stmmac: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-07-01  9:17   ` Krzysztof Kozlowski
  2024-07-01 16:54   ` Krzysztof Kozlowski
  2024-06-30 22:26 ` [PATCH 32/53] scsi: ibmvscsi_tgt: " Bart Van Assche
                   ` (21 subsequent siblings)
  52 siblings, 2 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Krzysztof Kozlowski

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/nfc/nfcmrvl/fw_dnld.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c
index e83f65596a88..fc8d9466422d 100644
--- a/drivers/nfc/nfcmrvl/fw_dnld.c
+++ b/drivers/nfc/nfcmrvl/fw_dnld.c
@@ -442,12 +442,10 @@ static void fw_dnld_rx_work(struct work_struct *work)
 
 int nfcmrvl_fw_dnld_init(struct nfcmrvl_private *priv)
 {
-	char name[32];
-
 	INIT_WORK(&priv->fw_dnld.rx_work, fw_dnld_rx_work);
-	snprintf(name, sizeof(name), "%s_nfcmrvl_fw_dnld_rx_wq",
-		 dev_name(&priv->ndev->nfc_dev->dev));
-	priv->fw_dnld.rx_wq = create_singlethread_workqueue(name);
+	priv->fw_dnld.rx_wq = create_singlethread_workqueue2(
+		"%s_nfcmrvl_fw_dnld_rx_wq",
+		dev_name(&priv->ndev->nfc_dev->dev));
 	if (!priv->fw_dnld.rx_wq)
 		return -ENOMEM;
 	skb_queue_head_init(&priv->fw_dnld.rx_q);

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 32/53] scsi: ibmvscsi_tgt: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (30 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 31/53] nfc: mrvl: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (20 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Tyrel Datwyler, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index 2fca17cf8b51..a106e3a1b833 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -3425,7 +3425,6 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
 	struct scsi_info *vscsi;
 	int rc = 0;
 	long hrc = 0;
-	char wq_name[24];
 
 	vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL);
 	if (!vscsi) {
@@ -3536,8 +3535,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
 	init_completion(&vscsi->wait_idle);
 	init_completion(&vscsi->unconfig);
 
-	snprintf(wq_name, 24, "ibmvscsis%s", dev_name(&vdev->dev));
-	vscsi->work_q = create_workqueue(wq_name);
+	vscsi->work_q = create_workqueue2("ibmvscsis%s", dev_name(&vdev->dev));
 	if (!vscsi->work_q) {
 		rc = -ENOMEM;
 		dev_err(&vscsi->dev, "create_workqueue failed\n");

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (31 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 32/53] scsi: ibmvscsi_tgt: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-07-01  0:15   ` Damien Le Moal
  2024-07-01  1:50   ` Jason Yan
  2024-06-30 22:26 ` [PATCH 34/53] scsi: mpi3mr: Simplify a create*_workqueue() call Bart Van Assche
                   ` (19 subsequent siblings)
  52 siblings, 2 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	James E.J. Bottomley, John Garry, Damien Le Moal, Jason Yan

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/libsas/sas_init.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index 9c8cc723170d..e7d2edf9e635 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -92,7 +92,6 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr)
 
 int sas_register_ha(struct sas_ha_struct *sas_ha)
 {
-	char name[64];
 	int error = 0;
 
 	mutex_init(&sas_ha->disco_mutex);
@@ -121,13 +120,13 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
 	}
 
 	error = -ENOMEM;
-	snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev));
-	sas_ha->event_q = create_singlethread_workqueue(name);
+	sas_ha->event_q = create_singlethread_workqueue2("%s_event_q",
+							 dev_name(sas_ha->dev));
 	if (!sas_ha->event_q)
 		goto Undo_ports;
 
-	snprintf(name, sizeof(name), "%s_disco_q", dev_name(sas_ha->dev));
-	sas_ha->disco_q = create_singlethread_workqueue(name);
+	sas_ha->disco_q = create_singlethread_workqueue2("%s_disco_q",
+							 dev_name(sas_ha->dev));
 	if (!sas_ha->disco_q)
 		goto Undo_event_q;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 34/53] scsi: mpi3mr: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (32 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 35/53] scsi: qedf: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (18 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Sathya Prakash Veerichetty, Kashyap Desai, Sumit Saxena,
	Sreekanth Reddy, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index c2a22e96f7b7..d0dfd0c43f71 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -2689,8 +2689,8 @@ void mpi3mr_start_watchdog(struct mpi3mr_ioc *mrioc)
 	snprintf(mrioc->watchdog_work_q_name,
 	    sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name,
 	    mrioc->id);
-	mrioc->watchdog_work_q =
-	    create_singlethread_workqueue(mrioc->watchdog_work_q_name);
+	mrioc->watchdog_work_q = create_singlethread_workqueue2(
+		"%s", mrioc->watchdog_work_q_name);
 	if (!mrioc->watchdog_work_q) {
 		ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__);
 		return;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 35/53] scsi: qedf: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (33 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 34/53] scsi: mpi3mr: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 36/53] scsi: qedi: " Bart Van Assche
                   ` (17 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Saurav Kashyap, Javed Hasan, GR-QLogic-Storage-Upstream,
	James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qedf/qedf_main.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 49adddf978cc..ffbd67a46368 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3372,9 +3372,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n",
 	    qedf->io_mempool);
 
-	sprintf(host_buf, "qedf_%u_link",
-	    qedf->lport->host->host_no);
-	qedf->link_update_wq = create_workqueue(host_buf);
+	qedf->link_update_wq =
+		create_workqueue2("qedf_%u_link", qedf->lport->host->host_no);
 	INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update);
 	INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery);
 	INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump);
@@ -3584,9 +3583,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 	ether_addr_copy(params.ll2_mac_address, qedf->mac);
 
 	/* Start LL2 processing thread */
-	snprintf(host_buf, 20, "qedf_%d_ll2", host->host_no);
-	qedf->ll2_recv_wq =
-		create_workqueue(host_buf);
+	qedf->ll2_recv_wq = create_workqueue2("qedf_%d_ll2", host->host_no);
 	if (!qedf->ll2_recv_wq) {
 		QEDF_ERR(&(qedf->dbg_ctx), "Failed to LL2 workqueue.\n");
 		rc = -ENOMEM;
@@ -3627,9 +3624,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 		}
 	}
 
-	sprintf(host_buf, "qedf_%u_timer", qedf->lport->host->host_no);
 	qedf->timer_work_queue =
-		create_workqueue(host_buf);
+		create_workqueue2("qedf_%u_timer", qedf->lport->host->host_no);
 	if (!qedf->timer_work_queue) {
 		QEDF_ERR(&(qedf->dbg_ctx), "Failed to start timer "
 			  "workqueue.\n");
@@ -3639,9 +3635,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 
 	/* DPC workqueue is not reaped during recovery unload */
 	if (mode != QEDF_MODE_RECOVERY) {
-		sprintf(host_buf, "qedf_%u_dpc",
-		    qedf->lport->host->host_no);
-		qedf->dpc_wq = create_workqueue(host_buf);
+		qedf->dpc_wq = create_workqueue2("qedf_%u_dpc",
+						 qedf->lport->host->host_no);
 	}
 	INIT_DELAYED_WORK(&qedf->recovery_work, qedf_recovery_handler);
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 36/53] scsi: qedi: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (34 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 35/53] scsi: qedf: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 37/53] scsi: qla2xxx: " Bart Van Assche
                   ` (16 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Nilesh Javali, Manish Rangankar, GR-QLogic-Storage-Upstream,
	James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qedi/qedi_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index cd0180b1f5b9..09da8209095a 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2766,8 +2766,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
 			goto free_cid_que;
 		}
 
-		sprintf(host_buf, "host_%d", qedi->shost->host_no);
-		qedi->tmf_thread = create_singlethread_workqueue(host_buf);
+		qedi->tmf_thread = create_singlethread_workqueue2(
+			"host_%d", qedi->shost->host_no);
 		if (!qedi->tmf_thread) {
 			QEDI_ERR(&qedi->dbg_ctx,
 				 "Unable to start tmf thread!\n");
@@ -2775,8 +2775,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
 			goto free_cid_que;
 		}
 
-		sprintf(host_buf, "qedi_ofld%d", qedi->shost->host_no);
-		qedi->offload_thread = create_workqueue(host_buf);
+		qedi->offload_thread =
+			create_workqueue2("qedi_ofld%d", qedi->shost->host_no);
 		if (!qedi->offload_thread) {
 			QEDI_ERR(&qedi->dbg_ctx,
 				 "Unable to start offload thread!\n");

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 37/53] scsi: qla2xxx: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (35 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 36/53] scsi: qedi: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 38/53] scsi: qla4xxx: Simplify a create*_workqueue() call Bart Van Assche
                   ` (15 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla2xxx/qla_os.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index fcb06df2ce4e..f3f4972962f0 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2915,7 +2915,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	scsi_qla_host_t *base_vha = NULL;
 	struct qla_hw_data *ha;
 	char pci_info[30];
-	char fw_str[30], wq_name[30];
+	char fw_str[30];
 	struct scsi_host_template *sht;
 	int bars, mem_only = 0;
 	uint16_t req_length = 0, rsp_length = 0;
@@ -3505,12 +3505,12 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error);
 
 	if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) {
-		sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no);
-		ha->dpc_lp_wq = create_singlethread_workqueue(wq_name);
+		ha->dpc_lp_wq = create_singlethread_workqueue2(
+			"qla2xxx_%lu_dpc_lp_wq", base_vha->host_no);
 		INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen);
 
-		sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no);
-		ha->dpc_hp_wq = create_singlethread_workqueue(wq_name);
+		ha->dpc_hp_wq = create_singlethread_workqueue2(
+			"qla2xxx_%lu_dpc_hp_wq", base_vha->host_no);
 		INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work);
 		INIT_WORK(&ha->idc_state_handler,
 		    qla83xx_idc_state_handler_work);

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 38/53] scsi: qla4xxx: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (36 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 37/53] scsi: qla2xxx: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 39/53] scsi: vmw_pvscsi: " Bart Van Assche
                   ` (14 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Nilesh Javali, Manish Rangankar, GR-QLogic-Storage-Upstream,
	James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla4xxx/ql4_os.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 17cccd14765f..267c459376ed 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -8630,7 +8630,6 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev,
 	struct Scsi_Host *host;
 	struct scsi_qla_host *ha;
 	uint8_t init_retry_count = 0;
-	char buf[34];
 	struct qla4_8xxx_legacy_intr_set *nx_legacy_intr;
 	uint32_t dev_state;
 
@@ -8805,8 +8804,8 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev,
 	/* Startup the kernel thread for this host adapter. */
 	DEBUG2(printk("scsi: %s: Starting kernel thread for "
 		      "qla4xxx_dpc\n", __func__));
-	sprintf(buf, "qla4xxx_%lu_dpc", ha->host_no);
-	ha->dpc_thread = create_singlethread_workqueue(buf);
+	ha->dpc_thread =
+		create_singlethread_workqueue2("qla4xxx_%lu_dpc", ha->host_no);
 	if (!ha->dpc_thread) {
 		ql4_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n");
 		ret = -ENODEV;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 39/53] scsi: vmw_pvscsi: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (37 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 38/53] scsi: qla4xxx: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 40/53] scsi: myrb: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (13 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Vishal Bhakta, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/vmw_pvscsi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index c4fea077265e..40ad8a3a32e0 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -1123,8 +1123,6 @@ static void pvscsi_msg_workqueue_handler(struct work_struct *data)
 
 static int pvscsi_setup_msg_workqueue(struct pvscsi_adapter *adapter)
 {
-	char name[32];
-
 	if (!pvscsi_use_msg)
 		return 0;
 
@@ -1134,10 +1132,8 @@ static int pvscsi_setup_msg_workqueue(struct pvscsi_adapter *adapter)
 	if (pvscsi_reg_read(adapter, PVSCSI_REG_OFFSET_COMMAND_STATUS) == -1)
 		return 0;
 
-	snprintf(name, sizeof(name),
-		 "vmw_pvscsi_wq_%u", adapter->host->host_no);
-
-	adapter->workqueue = create_singlethread_workqueue(name);
+	adapter->workqueue = create_singlethread_workqueue2(
+		"vmw_pvscsi_wq_%u", adapter->host->host_no);
 	if (!adapter->workqueue) {
 		printk(KERN_ERR "vmw_pvscsi: failed to create work queue\n");
 		return 0;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 40/53] scsi: myrb: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (38 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 39/53] scsi: vmw_pvscsi: " Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:26 ` [PATCH 41/53] scsi: myrs: " Bart Van Assche
                   ` (12 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Hannes Reinecke, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/myrb.c | 5 ++---
 drivers/scsi/myrb.h | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index f684eb5e0489..6e8f056c0939 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -112,9 +112,8 @@ static bool myrb_create_mempools(struct pci_dev *pdev, struct myrb_hba *cb)
 		return false;
 	}
 
-	snprintf(cb->work_q_name, sizeof(cb->work_q_name),
-		 "myrb_wq_%d", cb->host->host_no);
-	cb->work_q = create_singlethread_workqueue(cb->work_q_name);
+	cb->work_q =
+		create_singlethread_workqueue2("myrb_wq_%d", cb->host->host_no);
 	if (!cb->work_q) {
 		dma_pool_destroy(cb->dcdb_pool);
 		cb->dcdb_pool = NULL;
diff --git a/drivers/scsi/myrb.h b/drivers/scsi/myrb.h
index fb8eacfceee8..78dc4136fb10 100644
--- a/drivers/scsi/myrb.h
+++ b/drivers/scsi/myrb.h
@@ -712,7 +712,6 @@ struct myrb_hba {
 	struct Scsi_Host *host;
 
 	struct workqueue_struct *work_q;
-	char work_q_name[20];
 	struct delayed_work monitor_work;
 	unsigned long primary_monitor_time;
 	unsigned long secondary_monitor_time;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 41/53] scsi: myrs: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (39 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 40/53] scsi: myrb: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:26 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 42/53] scsi: stex: " Bart Van Assche
                   ` (11 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:26 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Hannes Reinecke, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/myrs.c | 5 ++---
 drivers/scsi/myrs.h | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index e824be9d9bbb..768475f1b3d8 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -2206,9 +2206,8 @@ static bool myrs_create_mempools(struct pci_dev *pdev, struct myrs_hba *cs)
 		return false;
 	}
 
-	snprintf(cs->work_q_name, sizeof(cs->work_q_name),
-		 "myrs_wq_%d", shost->host_no);
-	cs->work_q = create_singlethread_workqueue(cs->work_q_name);
+	cs->work_q =
+		create_singlethread_workqueue2("myrs_wq_%d", shost->host_no);
 	if (!cs->work_q) {
 		dma_pool_destroy(cs->dcdb_pool);
 		cs->dcdb_pool = NULL;
diff --git a/drivers/scsi/myrs.h b/drivers/scsi/myrs.h
index 9f6696d0ddd5..e1d6b123de7b 100644
--- a/drivers/scsi/myrs.h
+++ b/drivers/scsi/myrs.h
@@ -904,7 +904,6 @@ struct myrs_hba {
 	bool disable_enc_msg;
 
 	struct workqueue_struct *work_q;
-	char work_q_name[20];
 	struct delayed_work monitor_work;
 	unsigned long primary_monitor_time;
 	unsigned long secondary_monitor_time;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 42/53] scsi: stex: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (40 preceding siblings ...)
  2024-06-30 22:26 ` [PATCH 41/53] scsi: myrs: " Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 43/53] scsi: fcoe: " Bart Van Assche
                   ` (10 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/stex.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 8ffb75be99bc..5c88f6a8249e 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -334,7 +334,6 @@ struct st_hba {
 	struct st_ccb *wait_ccb;
 	__le32 *scratch;
 
-	char work_q_name[20];
 	struct workqueue_struct *work_q;
 	struct work_struct reset_work;
 	wait_queue_head_t reset_waitq;
@@ -1795,9 +1794,8 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	hba->pdev = pdev;
 	init_waitqueue_head(&hba->reset_waitq);
 
-	snprintf(hba->work_q_name, sizeof(hba->work_q_name),
-		 "stex_wq_%d", host->host_no);
-	hba->work_q = create_singlethread_workqueue(hba->work_q_name);
+	hba->work_q =
+		create_singlethread_workqueue2("stex_wq_%d", host->host_no);
 	if (!hba->work_q) {
 		printk(KERN_ERR DRV_NAME "(%s): create workqueue failed\n",
 			pci_name(pdev));

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 43/53] scsi: fcoe: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (41 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 42/53] scsi: stex: " Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 44/53] scsi: snic: " Bart Van Assche
                   ` (9 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Hannes Reinecke, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/fcoe/fcoe_sysfs.c | 7 +------
 include/scsi/fcoe_sysfs.h      | 1 -
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 453665ac6020..d534f4007399 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -45,8 +45,6 @@ MODULE_PARM_DESC(fcf_dev_loss_tmo,
  */
 #define fcoe_ctlr_id(x)				\
 	((x)->id)
-#define fcoe_ctlr_work_q_name(x)		\
-	((x)->work_q_name)
 #define fcoe_ctlr_work_q(x)			\
 	((x)->work_q)
 #define fcoe_ctlr_devloss_work_q_name(x)	\
@@ -797,10 +795,7 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
 
 	ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo;
 
-	snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name),
-		 "ctlr_wq_%d", ctlr->id);
-	ctlr->work_q = create_singlethread_workqueue(
-		ctlr->work_q_name);
+	ctlr->work_q = create_singlethread_workqueue2("ctlr_wq_%d", ctlr->id);
 	if (!ctlr->work_q)
 		goto out_del;
 
diff --git a/include/scsi/fcoe_sysfs.h b/include/scsi/fcoe_sysfs.h
index 4b1216de3f22..45b1e9ca92e9 100644
--- a/include/scsi/fcoe_sysfs.h
+++ b/include/scsi/fcoe_sysfs.h
@@ -50,7 +50,6 @@ struct fcoe_ctlr_device {
 	struct fcoe_sysfs_function_template *f;
 
 	struct list_head		fcfs;
-	char				work_q_name[20];
 	struct workqueue_struct		*work_q;
 	char				devloss_work_q_name[20];
 	struct workqueue_struct		*devloss_work_q;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 44/53] scsi: snic: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (42 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 43/53] scsi: fcoe: " Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 45/53] scsi: scsi_transport_fc: " Bart Van Assche
                   ` (8 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Karan Tilak Kumar, Sesidhar Baddela, James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called. Not setting
shost->work_q_name is safe because there is no code that reads this
struct member. Additionally, a later patch removes this struct member.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/snic/snic_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c
index cc824dcfe7da..676ccf41b9da 100644
--- a/drivers/scsi/snic/snic_main.c
+++ b/drivers/scsi/snic/snic_main.c
@@ -300,9 +300,8 @@ snic_add_host(struct Scsi_Host *shost, struct pci_dev *pdev)
 	}
 
 	SNIC_BUG_ON(shost->work_q != NULL);
-	snprintf(shost->work_q_name, sizeof(shost->work_q_name), "scsi_wq_%d",
-		 shost->host_no);
-	shost->work_q = create_singlethread_workqueue(shost->work_q_name);
+	shost->work_q =
+		create_singlethread_workqueue2("scsi_wq_%d", shost->host_no);
 	if (!shost->work_q) {
 		SNIC_HOST_ERR(shost, "Failed to Create ScsiHost wq.\n");
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 45/53] scsi: scsi_transport_fc: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (43 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 44/53] scsi: snic: " Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 46/53] scsi: core: Simplify the alloc_workqueue() calls Bart Van Assche
                   ` (7 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	James E.J. Bottomley

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_transport_fc.c | 4 +---
 include/scsi/scsi_transport_fc.h | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 7d088b8da075..d07e82fd82a8 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -441,9 +441,7 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
 	fc_host->next_vport_number = 0;
 	fc_host->npiv_vports_inuse = 0;
 
-	snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name),
-		 "fc_wq_%d", shost->host_no);
-	fc_host->work_q = alloc_workqueue("%s", 0, 0, fc_host->work_q_name);
+	fc_host->work_q = alloc_workqueue("fc_wq_%d", 0, 0, shost->host_no);
 	if (!fc_host->work_q)
 		return -ENOMEM;
 
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 4b884b8013e0..b0688652ce39 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -575,7 +575,6 @@ struct fc_host_attrs {
 	u16 npiv_vports_inuse;
 
 	/* work queues for rport state manipulation */
-	char work_q_name[20];
 	struct workqueue_struct *work_q;
 	char devloss_work_q_name[20];
 	struct workqueue_struct *devloss_work_q;
@@ -654,8 +653,6 @@ struct fc_host_attrs {
 	(((struct fc_host_attrs *)(x)->shost_data)->next_vport_number)
 #define fc_host_npiv_vports_inuse(x)	\
 	(((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse)
-#define fc_host_work_q_name(x) \
-	(((struct fc_host_attrs *)(x)->shost_data)->work_q_name)
 #define fc_host_work_q(x) \
 	(((struct fc_host_attrs *)(x)->shost_data)->work_q)
 #define fc_host_devloss_work_q_name(x) \

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 46/53] scsi: core: Simplify the alloc_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (44 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 45/53] scsi: scsi_transport_fc: " Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call Bart Van Assche
                   ` (6 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	James E.J. Bottomley

Pass a format string to alloc_workqueue2() instead of formatting the
workqueue name before alloc_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/hosts.c     | 9 ++++-----
 include/scsi/scsi_host.h | 1 -
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 7f987335b44c..e021f1106bea 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -292,11 +292,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	}
 
 	if (shost->transportt->create_work_queue) {
-		snprintf(shost->work_q_name, sizeof(shost->work_q_name),
-			 "scsi_wq_%d", shost->host_no);
-		shost->work_q = alloc_workqueue("%s",
-			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
-			1, shost->work_q_name);
+		shost->work_q = alloc_workqueue(
+			"scsi_wq_%d",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 1,
+			shost->host_no);
 
 		if (!shost->work_q) {
 			error = -EINVAL;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 19a1c5c48935..2b4ab0369ffb 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -677,7 +677,6 @@ struct Scsi_Host {
 	/*
 	 * Optional work queue to be utilized by the transport
 	 */
-	char work_q_name[20];
 	struct workqueue_struct *work_q;
 
 	/*

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (45 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 46/53] scsi: core: Simplify the alloc_workqueue() calls Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-08-09 15:21   ` Andy Shevchenko
  2024-06-30 22:27 ` [PATCH 48/53] scsi: ufs: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (5 subsequent siblings)
  52 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko, Hugo Villeneuve

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/tty/serial/max3100.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index fda63918d1eb..e8e7a36d73cf 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -548,7 +548,6 @@ static void max3100_shutdown(struct uart_port *port)
 static int max3100_startup(struct uart_port *port)
 {
 	struct max3100_port *s = to_max3100_port(port);
-	char b[12];
 	int ret;
 
 	dev_dbg(&s->spi->dev, "%s\n", __func__);
@@ -564,8 +563,7 @@ static int max3100_startup(struct uart_port *port)
 	s->parity = 0;
 	s->rts = 0;
 
-	sprintf(b, "max3100-%d", s->minor);
-	s->workqueue = create_freezable_workqueue(b);
+	s->workqueue = create_freezable_workqueue2("max3100-%d", s->minor);
 	if (!s->workqueue) {
 		dev_warn(&s->spi->dev, "cannot create workqueue\n");
 		return -EBUSY;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 48/53] scsi: ufs: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (46 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 49/53] usb: typec: ucsi: Simplify a create*_workqueue() call Bart Van Assche
                   ` (4 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	James E.J. Bottomley, Avri Altman, Peter Wang,
	Manivannan Sadhasivam, Bean Huo

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 1b65e6ae4137..9df5b82a6790 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -1783,8 +1783,6 @@ static void ufshcd_remove_clk_scaling_sysfs(struct ufs_hba *hba)
 
 static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
 {
-	char wq_name[sizeof("ufs_clkscaling_00")];
-
 	if (!ufshcd_is_clkscaling_supported(hba))
 		return;
 
@@ -1796,9 +1794,8 @@ static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
 	INIT_WORK(&hba->clk_scaling.resume_work,
 		  ufshcd_clk_scaling_resume_work);
 
-	snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d",
-		 hba->host->host_no);
-	hba->clk_scaling.workq = create_singlethread_workqueue(wq_name);
+	hba->clk_scaling.workq = create_singlethread_workqueue2(
+		"ufs_clkscaling_%d", hba->host->host_no);
 
 	hba->clk_scaling.is_initialized = true;
 }
@@ -10328,7 +10325,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 	int err;
 	struct Scsi_Host *host = hba->host;
 	struct device *dev = hba->dev;
-	char eh_wq_name[sizeof("ufs_eh_wq_00")];
 
 	/*
 	 * dev_set_drvdata() must be called before any callbacks are registered
@@ -10395,9 +10391,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 	hba->max_pwr_info.is_valid = false;
 
 	/* Initialize work queues */
-	snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d",
-		 hba->host->host_no);
-	hba->eh_wq = create_singlethread_workqueue(eh_wq_name);
+	hba->eh_wq = create_singlethread_workqueue2("ufs_eh_wq_%d",
+						    hba->host->host_no);
 	if (!hba->eh_wq) {
 		dev_err(hba->dev, "%s: failed to create eh workqueue\n",
 			__func__);

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 49/53] usb: typec: ucsi: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (47 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 48/53] scsi: ufs: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 50/53] cifs: " Bart Van Assche
                   ` (3 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Heikki Krogerus, Greg Kroah-Hartman, Dmitry Baryshkov,
	Christian A. Ehrhardt, Prashant Malani, Jameson Thies,
	Abhishek Pandit-Subedi

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/usb/typec/ucsi/ucsi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 2cc7aedd490f..2209f45c2b9a 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1504,15 +1504,10 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
 	enum typec_accessory *accessory = cap->accessory;
 	enum usb_role u_role = USB_ROLE_NONE;
 	u64 command;
-	char *name;
 	int ret;
 
-	name = kasprintf(GFP_KERNEL, "%s-con%d", dev_name(ucsi->dev), con->num);
-	if (!name)
-		return -ENOMEM;
-
-	con->wq = create_singlethread_workqueue(name);
-	kfree(name);
+	con->wq = create_singlethread_workqueue2("%s-con%d",
+						 dev_name(ucsi->dev), con->num);
 	if (!con->wq)
 		return -ENOMEM;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 50/53] cifs: Simplify a create*_workqueue() call
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (48 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 49/53] usb: typec: ucsi: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 51/53] mac802154: Simplify the create*_workqueue() calls Bart Van Assche
                   ` (2 subsequent siblings)
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Steve French

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 fs/smb/client/smbdirect.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
index d74e829de51c..045067fa2a37 100644
--- a/fs/smb/client/smbdirect.c
+++ b/fs/smb/client/smbdirect.c
@@ -1458,8 +1458,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)
 	if (!info->response_mempool)
 		goto out3;
 
-	scnprintf(name, MAX_NAME_LEN, "smbd_%p", info);
-	info->workqueue = create_workqueue(name);
+	info->workqueue = create_workqueue2("smbd_%p", info);
 	if (!info->workqueue)
 		goto out4;
 

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 51/53] mac802154: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (49 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 50/53] cifs: " Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-06-30 22:27 ` [PATCH 52/53] nfc: nci: " Bart Van Assche
  2024-07-01 19:39 ` [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Tejun Heo
  52 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Alexander Aring, Stefan Schmidt, Miquel Raynal, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni

Pass a format string to create*_workqueue2() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 net/mac802154/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 9ab7396668d2..9da6b21eb3b5 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -193,19 +193,18 @@ static void ieee802154_setup_wpan_phy_pib(struct wpan_phy *wpan_phy)
 int ieee802154_register_hw(struct ieee802154_hw *hw)
 {
 	struct ieee802154_local *local = hw_to_local(hw);
-	char mac_wq_name[IFNAMSIZ + 10] = {};
 	struct net_device *dev;
 	int rc = -ENOSYS;
 
 	local->workqueue =
-		create_singlethread_workqueue(wpan_phy_name(local->phy));
+		create_singlethread_workqueue2("%s", wpan_phy_name(local->phy));
 	if (!local->workqueue) {
 		rc = -ENOMEM;
 		goto out;
 	}
 
-	snprintf(mac_wq_name, IFNAMSIZ + 10, "%s-mac-cmds", wpan_phy_name(local->phy));
-	local->mac_wq =	create_singlethread_workqueue(mac_wq_name);
+	local->mac_wq = create_singlethread_workqueue2(
+		"%s-mac-cmds", wpan_phy_name(local->phy));
 	if (!local->mac_wq) {
 		rc = -ENOMEM;
 		goto out_wq;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 52/53] nfc: nci: Simplify the create*_workqueue() calls
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (50 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 51/53] mac802154: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-06-30 22:27 ` Bart Van Assche
  2024-07-01 16:54   ` Krzysztof Kozlowski
  2024-07-01 19:39 ` [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Tejun Heo
  52 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-06-30 22:27 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Bart Van Assche,
	Krzysztof Kozlowski, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Ryosuke Yasuoka, Fedor Pchelkin,
	Jeremy Cline, Tetsuo Handa

Pass a format string to create*_workqueue() instead of formatting the
workqueue name before create*_workqueue() is called.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 net/nfc/nci/core.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index f456a5911e7d..4b5cb2017e39 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -1225,29 +1225,28 @@ int nci_register_device(struct nci_dev *ndev)
 {
 	int rc;
 	struct device *dev = &ndev->nfc_dev->dev;
-	char name[32];
 
 	ndev->flags = 0;
 
 	INIT_WORK(&ndev->cmd_work, nci_cmd_work);
-	snprintf(name, sizeof(name), "%s_nci_cmd_wq", dev_name(dev));
-	ndev->cmd_wq = create_singlethread_workqueue(name);
+	ndev->cmd_wq =
+		create_singlethread_workqueue2("%s_nci_cmd_wq", dev_name(dev));
 	if (!ndev->cmd_wq) {
 		rc = -ENOMEM;
 		goto exit;
 	}
 
 	INIT_WORK(&ndev->rx_work, nci_rx_work);
-	snprintf(name, sizeof(name), "%s_nci_rx_wq", dev_name(dev));
-	ndev->rx_wq = create_singlethread_workqueue(name);
+	ndev->rx_wq =
+		create_singlethread_workqueue2("%s_nci_rx_wq", dev_name(dev));
 	if (!ndev->rx_wq) {
 		rc = -ENOMEM;
 		goto destroy_cmd_wq_exit;
 	}
 
 	INIT_WORK(&ndev->tx_work, nci_tx_work);
-	snprintf(name, sizeof(name), "%s_nci_tx_wq", dev_name(dev));
-	ndev->tx_wq = create_singlethread_workqueue(name);
+	ndev->tx_wq =
+		create_singlethread_workqueue2("%s_nci_tx_wq", dev_name(dev));
 	if (!ndev->tx_wq) {
 		rc = -ENOMEM;
 		goto destroy_rx_wq_exit;

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls
  2024-06-30 22:26 ` [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls Bart Van Assche
@ 2024-07-01  0:15   ` Damien Le Moal
  2024-07-01  1:50   ` Jason Yan
  1 sibling, 0 replies; 71+ messages in thread
From: Damien Le Moal @ 2024-07-01  0:15 UTC (permalink / raw)
  To: Bart Van Assche, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel,
	James E.J. Bottomley, John Garry, Jason Yan

On 7/1/24 07:26, Bart Van Assche wrote:
> Pass a format string to create*_workqueue2() instead of formatting the
> workqueue name before create*_workqueue() is called.
> 
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Looks good.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls
  2024-06-30 22:26 ` [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls Bart Van Assche
  2024-07-01  0:15   ` Damien Le Moal
@ 2024-07-01  1:50   ` Jason Yan
  1 sibling, 0 replies; 71+ messages in thread
From: Jason Yan @ 2024-07-01  1:50 UTC (permalink / raw)
  To: Bart Van Assche, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel,
	James E.J. Bottomley, John Garry, Damien Le Moal

Bart Van Assche 於 2024/7/1 6:26 寫道:
> Pass a format string to create*_workqueue2() instead of formatting the
> workqueue name before create*_workqueue() is called.
> 
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/libsas/sas_init.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)

Reviewed-by: Jason Yan <yanaijie@huawei.com>

祝一切顺利

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-06-30 22:26 ` [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros Bart Van Assche
@ 2024-07-01  2:51   ` Lai Jiangshan
  2024-07-01 16:42     ` Bart Van Assche
  0 siblings, 1 reply; 71+ messages in thread
From: Lai Jiangshan @ 2024-07-01  2:51 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Tejun Heo, Martin K . Petersen, linux-kernel

Hello

On Mon, Jul 1, 2024 at 6:29 AM Bart Van Assche <bvanassche@acm.org> wrote:

> --- a/include/linux/workqueue.h
> +++ b/include/linux/workqueue.h
> @@ -525,11 +525,20 @@ alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...);
>
>  #define create_workqueue(name)                                         \
>         alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))
> +#define create_workqueue2(fmt, args...) \
> +       alloc_workqueue(fmt, __WQ_LEGACY | WQ_MEM_RECLAIM, 1, ##args)
>  #define create_freezable_workqueue(name)                               \
>         alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND | \
>                         WQ_MEM_RECLAIM, 1, (name))

Is there any possible preprocessor hack to avoid the renaming of the functions?

Thanks
Lai

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 31/53] nfc: mrvl: Simplify a create*_workqueue() call
  2024-06-30 22:26 ` [PATCH 31/53] nfc: mrvl: " Bart Van Assche
@ 2024-07-01  9:17   ` Krzysztof Kozlowski
  2024-07-01 16:44     ` Bart Van Assche
  2024-07-01 16:54   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 71+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-01  9:17 UTC (permalink / raw)
  To: Bart Van Assche, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel

On 01/07/2024 00:26, Bart Van Assche wrote:
> Pass a format string to create*_workqueue2() instead of formatting the
> workqueue name before create*_workqueue() is called.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/nfc/nfcmrvl/fw_dnld.c | 8 +++-----

I only got this patch, no links to new API being introduced and there is
no create_singlethread_workqueue2() call. Looks fine, but tricky to
review. Provide first patch or lore link in patch changelog.


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-07-01  2:51   ` Lai Jiangshan
@ 2024-07-01 16:42     ` Bart Van Assche
  2024-07-03 20:24       ` Kees Cook
  0 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-07-01 16:42 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Tejun Heo, Martin K . Petersen, linux-kernel

On 6/30/24 7:51 PM, Lai Jiangshan wrote:
> On Mon, Jul 1, 2024 at 6:29 AM Bart Van Assche <bvanassche@acm.org> wrote:
> 
>> --- a/include/linux/workqueue.h
>> +++ b/include/linux/workqueue.h
>> @@ -525,11 +525,20 @@ alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...);
>>
>>   #define create_workqueue(name)                                         \
>>          alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))
>> +#define create_workqueue2(fmt, args...) \
>> +       alloc_workqueue(fmt, __WQ_LEGACY | WQ_MEM_RECLAIM, 1, ##args)
>>   #define create_freezable_workqueue(name)                               \
>>          alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND | \
>>                          WQ_MEM_RECLAIM, 1, (name))
> 
> Is there any possible preprocessor hack to avoid the renaming of the functions?

Thanks Lai for having taken a look. As one can see here the last patch 
of this patch series renames create_workqueue2() back to 
create_workqueue(): 
https://lore.kernel.org/linux-kernel/20240630222904.627462-1-bvanassche@acm.org/

Bart.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 31/53] nfc: mrvl: Simplify a create*_workqueue() call
  2024-07-01  9:17   ` Krzysztof Kozlowski
@ 2024-07-01 16:44     ` Bart Van Assche
  0 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-07-01 16:44 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel

On 7/1/24 2:17 AM, Krzysztof Kozlowski wrote:
> On 01/07/2024 00:26, Bart Van Assche wrote:
>> Pass a format string to create*_workqueue2() instead of formatting the
>> workqueue name before create*_workqueue() is called.
>>
>> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>> ---
>>   drivers/nfc/nfcmrvl/fw_dnld.c | 8 +++-----
> 
> I only got this patch, no links to new API being introduced and there is
> no create_singlethread_workqueue2() call. Looks fine, but tricky to
> review. Provide first patch or lore link in patch changelog.

Thanks for the advice. I will do this if I have to repost this patch
series.

This is the link to the entire patch series:
https://lore.kernel.org/linux-kernel/20240630222904.627462-1-bvanassche@acm.org/

Further feedback is welcome.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 31/53] nfc: mrvl: Simplify a create*_workqueue() call
  2024-06-30 22:26 ` [PATCH 31/53] nfc: mrvl: " Bart Van Assche
  2024-07-01  9:17   ` Krzysztof Kozlowski
@ 2024-07-01 16:54   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 71+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-01 16:54 UTC (permalink / raw)
  To: Bart Van Assche, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel

On 01/07/2024 00:26, Bart Van Assche wrote:
> Pass a format string to create*_workqueue2() instead of formatting the
> workqueue name before create*_workqueue() is called.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 52/53] nfc: nci: Simplify the create*_workqueue() calls
  2024-06-30 22:27 ` [PATCH 52/53] nfc: nci: " Bart Van Assche
@ 2024-07-01 16:54   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 71+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-01 16:54 UTC (permalink / raw)
  To: Bart Van Assche, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Ryosuke Yasuoka,
	Fedor Pchelkin, Jeremy Cline, Tetsuo Handa

On 01/07/2024 00:27, Bart Van Assche wrote:
> Pass a format string to create*_workqueue() instead of formatting the
> workqueue name before create*_workqueue() is called.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 23/53] pds_core: Simplify a create*_workqueue() call
  2024-06-30 22:26 ` [PATCH 23/53] pds_core: " Bart Van Assche
@ 2024-07-01 18:49   ` Brett Creeley
  2024-07-01 19:53     ` Bart Van Assche
  0 siblings, 1 reply; 71+ messages in thread
From: Brett Creeley @ 2024-07-01 18:49 UTC (permalink / raw)
  To: Bart Van Assche, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Shannon Nelson,
	Brett Creeley, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni



On 6/30/2024 3:26 PM, Bart Van Assche wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> Pass a format string to create*_workqueue2() instead of formatting the
> workqueue name before create*_workqueue() is called.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/net/ethernet/amd/pds_core/main.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/pds_core/main.c b/drivers/net/ethernet/amd/pds_core/main.c
> index 660268ff9562..e2e49656c111 100644
> --- a/drivers/net/ethernet/amd/pds_core/main.c
> +++ b/drivers/net/ethernet/amd/pds_core/main.c
> @@ -213,12 +213,9 @@ static const struct devlink_param pdsc_dl_params[] = {
>                                pdsc_dl_enable_validate),
>   };
> 
> -#define PDSC_WQ_NAME_LEN 24
> -
>   static int pdsc_init_pf(struct pdsc *pdsc)
>   {
>          struct devlink_health_reporter *hr;
> -       char wq_name[PDSC_WQ_NAME_LEN];
>          struct devlink *dl;
>          int err;
> 
> @@ -236,8 +233,8 @@ static int pdsc_init_pf(struct pdsc *pdsc)
>                  goto err_out_release_regions;
> 
>          /* General workqueue and timer, but don't start timer yet */
> -       snprintf(wq_name, sizeof(wq_name), "%s.%d", PDS_CORE_DRV_NAME, pdsc->uid);
> -       pdsc->wq = create_singlethread_workqueue(wq_name);
> +       pdsc->wq = create_singlethread_workqueue2("%s.%d", PDS_CORE_DRV_NAME,
> +                                                 pdsc->uid);

LGTM. Thanks.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>

BTW, I don't actually see patch 53/53 that renames *workqueue2() -> 
*workqueue(). Am I missing something here? It's mentioned in the cover 
letter, but I don't see it on the series thread.

Brett

>          INIT_WORK(&pdsc->health_work, pdsc_health_thread);
>          INIT_WORK(&pdsc->pci_reset_work, pdsc_pci_reset_thread);
>          timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 00/53] Let create*_workqueue() accept a printf-style format string
  2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
                   ` (51 preceding siblings ...)
  2024-06-30 22:27 ` [PATCH 52/53] nfc: nci: " Bart Van Assche
@ 2024-07-01 19:39 ` Tejun Heo
  2024-07-01 20:13   ` Bart Van Assche
  52 siblings, 1 reply; 71+ messages in thread
From: Tejun Heo @ 2024-07-01 19:39 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel

Hello, Bart.

On Sun, Jun 30, 2024 at 03:26:18PM -0700, Bart Van Assche wrote:
> 1. Introduce the create*_workqueue2() macros that accept a printf-style
>    format string and argument list.

I don't think we want to update create_workqueue() interface at all. Please
convert them to use alloc_workqueue() instead. Once we convert all
create_workqueue() users then we can just drop the old interface.

The challenge with converging to alloc_workqueue() interface is that the
conversion needs to explicitly decide whether WQ_MEM_RECLAIM is needed or
not but that shouldn't be *too* difficult.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 23/53] pds_core: Simplify a create*_workqueue() call
  2024-07-01 18:49   ` Brett Creeley
@ 2024-07-01 19:53     ` Bart Van Assche
  0 siblings, 0 replies; 71+ messages in thread
From: Bart Van Assche @ 2024-07-01 19:53 UTC (permalink / raw)
  To: Brett Creeley, Tejun Heo
  Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel, Shannon Nelson,
	Brett Creeley, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

On 7/1/24 11:49 AM, Brett Creeley wrote:
> LGTM. Thanks.
> 
> Reviewed-by: Brett Creeley <brett.creeley@amd.com>
> 
> BTW, I don't actually see patch 53/53 that renames *workqueue2() ->
> *workqueue(). Am I missing something here? It's mentioned in the
> cover letter, but I don't see it on the series thread.
Hi Brett,

I don't see patch 53/53 either on Lore. Maybe I hit an outgoing mail
limit when I sent out this patch series.

Note: as one can see from Tejun's reply to the cover letter I will have
to rework this patch series so I'm not sure whether it's useful that I
make patch 53/53 available now.

Thanks,

Bart.


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 00/53] Let create*_workqueue() accept a printf-style format string
  2024-07-01 19:39 ` [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Tejun Heo
@ 2024-07-01 20:13   ` Bart Van Assche
  2024-07-01 20:17     ` Tejun Heo
  0 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-07-01 20:13 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel

On 7/1/24 12:39 PM, Tejun Heo wrote:
> On Sun, Jun 30, 2024 at 03:26:18PM -0700, Bart Van Assche wrote:
>> 1. Introduce the create*_workqueue2() macros that accept a printf-style
>>     format string and argument list.
> 
> I don't think we want to update create_workqueue() interface at all. Please
> convert them to use alloc_workqueue() instead. Once we convert all
> create_workqueue() users then we can just drop the old interface.
> 
> The challenge with converging to alloc_workqueue() interface is that the
> conversion needs to explicitly decide whether WQ_MEM_RECLAIM is needed or
> not but that shouldn't be *too* difficult.

The create*_workqueue() macros are used about 270 times in the Linux
kernel (the macro names also occur in some comments):

$ git grep -nHEw 
'create_workqueue|create_freezable_workqueue|create_singlethread_workqueue' 
| grep -Ev 'Documentation/|include/linux/workqueue' | wc -l
     271

That's too much for a single patch series. I can start with converting
the SCSI workqueue creation code.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 00/53] Let create*_workqueue() accept a printf-style format string
  2024-07-01 20:13   ` Bart Van Assche
@ 2024-07-01 20:17     ` Tejun Heo
  0 siblings, 0 replies; 71+ messages in thread
From: Tejun Heo @ 2024-07-01 20:17 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Lai Jiangshan, Martin K . Petersen, linux-kernel

Hello, Bart.

On Mon, Jul 01, 2024 at 01:13:57PM -0700, Bart Van Assche wrote:
> The create*_workqueue() macros are used about 270 times in the Linux
> kernel (the macro names also occur in some comments):
> 
> $ git grep -nHEw
> 'create_workqueue|create_freezable_workqueue|create_singlethread_workqueue'
> | grep -Ev 'Documentation/|include/linux/workqueue' | wc -l
>     271
> 
> That's too much for a single patch series. I can start with converting
> the SCSI workqueue creation code.

Yeah, it's been on the to-do list for a long time. Starting with SCSI sounds
great.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-07-01 16:42     ` Bart Van Assche
@ 2024-07-03 20:24       ` Kees Cook
  2024-07-03 21:28         ` Bart Van Assche
  0 siblings, 1 reply; 71+ messages in thread
From: Kees Cook @ 2024-07-03 20:24 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Lai Jiangshan, Tejun Heo, Martin K . Petersen, linux-kernel

On Mon, Jul 01, 2024 at 09:42:50AM -0700, Bart Van Assche wrote:
> On 6/30/24 7:51 PM, Lai Jiangshan wrote:
> > On Mon, Jul 1, 2024 at 6:29 AM Bart Van Assche <bvanassche@acm.org> wrote:
> > 
> > > --- a/include/linux/workqueue.h
> > > +++ b/include/linux/workqueue.h
> > > @@ -525,11 +525,20 @@ alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...);
> > > 
> > >   #define create_workqueue(name)                                         \
> > >          alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))
> > > +#define create_workqueue2(fmt, args...) \
> > > +       alloc_workqueue(fmt, __WQ_LEGACY | WQ_MEM_RECLAIM, 1, ##args)
> > >   #define create_freezable_workqueue(name)                               \
> > >          alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND | \
> > >                          WQ_MEM_RECLAIM, 1, (name))
> > 
> > Is there any possible preprocessor hack to avoid the renaming of the functions?
> 
> Thanks Lai for having taken a look. As one can see here the last patch of
> this patch series renames create_workqueue2() back to create_workqueue(): https://lore.kernel.org/linux-kernel/20240630222904.627462-1-bvanassche@acm.org/

This can be done with the preprocessor to detect how many arguments
are being used, so then there is no need to do the renaming passes and
conversions can land via subsystems:


diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index fb3993894536..00420f85b881 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -523,13 +523,24 @@ alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...);
 #define alloc_ordered_workqueue(fmt, flags, args...)			\
 	alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)
 
-#define create_workqueue(name)						\
-	alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))
-#define create_freezable_workqueue(name)				\
-	alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND |	\
-			WQ_MEM_RECLAIM, 1, (name))
-#define create_singlethread_workqueue(name)				\
-	alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, name)
+#define __has_one_arg(args...)  __is_defined(COUNT_ARGS(args))
+
+#define __create_workqueue1(flags, name) \
+                alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM | (flags), \
+				1, name)
+#define __create_workqueue0(flags, fmt, args...) \
+                alloc_workqueue(fmt, __WQ_LEGACY | WQ_MEM_RECLAIM | (flags), \
+				1, args)
+
+#define create_workqueue(args...) \
+        CONCATENATE(__create_workqueue, __has_one_arg(args))\
+                (0, args)
+#define create_freezeable_workqueue(args...) \
+        CONCATENATE(__create_workqueue, __has_one_arg(args))\
+                (WQ_UNBOUND | WQ_FREEZABLE, args)
+#define create_singlethread_workqueue(args...) \
+        CONCATENATE(__create_workqueue, __has_one_arg(args))\
+                (WQ_UNBOUND | __WQ_ORDERED, args)
 
 #define from_work(var, callback_work, work_fieldname)	\
 	container_of(callback_work, typeof(*var), work_fieldname)



Now conversions are one step, e.g.:

diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
index d74e829de51c..f7f27c6f1a15 100644
--- a/fs/smb/client/smbdirect.c
+++ b/fs/smb/client/smbdirect.c
@@ -1458,8 +1458,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)
 	if (!info->response_mempool)
 		goto out3;
 
-	scnprintf(name, MAX_NAME_LEN, "smbd_%p", info);
-	info->workqueue = create_workqueue(name);
+	info->workqueue = create_workqueue("smbd_%p", info);
 	if (!info->workqueue)
 		goto out4;
 
-- 
Kees Cook

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-07-03 20:24       ` Kees Cook
@ 2024-07-03 21:28         ` Bart Van Assche
  2024-07-03 22:20           ` Kees Cook
  0 siblings, 1 reply; 71+ messages in thread
From: Bart Van Assche @ 2024-07-03 21:28 UTC (permalink / raw)
  To: Kees Cook; +Cc: Lai Jiangshan, Tejun Heo, Martin K . Petersen, linux-kernel

On 7/3/24 1:24 PM, Kees Cook wrote:
> This can be done with the preprocessor to detect how many arguments
> are being used, so then there is no need to do the renaming passes and
> conversions can land via subsystems:

Thanks Kees, this is very useful feedback.

As one can see here, Tejun requested not to add support for a format
string in the create*_workqueue() macros:
https://lore.kernel.org/linux-kernel/ZoMF1ZydZUusxRcf@slm.duckdns.org/

Hence a different approach for the SCSI create*_workqueue() macros:
https://lore.kernel.org/linux-scsi/20240702215228.2743420-1-bvanassche@acm.org/

Best regards,

Bart.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-07-03 21:28         ` Bart Van Assche
@ 2024-07-03 22:20           ` Kees Cook
  2024-07-03 22:33             ` Tejun Heo
  0 siblings, 1 reply; 71+ messages in thread
From: Kees Cook @ 2024-07-03 22:20 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Lai Jiangshan, Tejun Heo, Martin K . Petersen, linux-kernel

On Wed, Jul 03, 2024 at 02:28:34PM -0700, Bart Van Assche wrote:
> On 7/3/24 1:24 PM, Kees Cook wrote:
> > This can be done with the preprocessor to detect how many arguments
> > are being used, so then there is no need to do the renaming passes and
> > conversions can land via subsystems:
> 
> Thanks Kees, this is very useful feedback.
> 
> As one can see here, Tejun requested not to add support for a format
> string in the create*_workqueue() macros:
> https://lore.kernel.org/linux-kernel/ZoMF1ZydZUusxRcf@slm.duckdns.org/

Ah! I should have read the thread more fully. :)

> Hence a different approach for the SCSI create*_workqueue() macros:
> https://lore.kernel.org/linux-scsi/20240702215228.2743420-1-bvanassche@acm.org/

Gotcha. Okay, well, that's a lot of flags to open-code, but I guess
that's fine? :P

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros
  2024-07-03 22:20           ` Kees Cook
@ 2024-07-03 22:33             ` Tejun Heo
  0 siblings, 0 replies; 71+ messages in thread
From: Tejun Heo @ 2024-07-03 22:33 UTC (permalink / raw)
  To: Kees Cook
  Cc: Bart Van Assche, Lai Jiangshan, Martin K . Petersen, linux-kernel

Hello,

On Wed, Jul 03, 2024 at 03:20:17PM -0700, Kees Cook wrote:
> > Hence a different approach for the SCSI create*_workqueue() macros:
> > https://lore.kernel.org/linux-scsi/20240702215228.2743420-1-bvanassche@acm.org/
> 
> Gotcha. Okay, well, that's a lot of flags to open-code, but I guess
> that's fine? :P

The flag in question is WQ_MEM_RECLAIM and that flag has a direct cost of
creating a dedicated kthread which mostly sits idle, so we want it to be
explicit. In SCSI, the naive expansion is likely to be correct for most
cases.

It's a bit tricky in that the failure mode of incorrectly missing the flag
is critical (system deadlock under memory pressure) but can be difficult to
trigger and the depencency chain may not be immediately evident when looking
at the code. The upsides are that when it happens, it's usually not too
difficult to tell from the backtraces and lockdep annotation sometimes helps
with finding missing cases (which is suppressed when using the old interface
because it's unclear whether MEM_RECLAIM is there intentionally or not).

Anyways, yeah, we want it to be explicit.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call
  2024-06-30 22:27 ` [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call Bart Van Assche
@ 2024-08-09 15:21   ` Andy Shevchenko
  0 siblings, 0 replies; 71+ messages in thread
From: Andy Shevchenko @ 2024-08-09 15:21 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Tejun Heo, Lai Jiangshan, Martin K . Petersen, linux-kernel,
	Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve

On Sun, Jun 30, 2024 at 03:27:05PM -0700, Bart Van Assche wrote:
> Pass a format string to create*_workqueue2() instead of formatting the
> workqueue name before create*_workqueue() is called.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2024-08-09 15:21 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-30 22:26 [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Bart Van Assche
2024-06-30 22:26 ` [PATCH 01/53] workqueue: Introduce the create*_workqueue2() macros Bart Van Assche
2024-07-01  2:51   ` Lai Jiangshan
2024-07-01 16:42     ` Bart Van Assche
2024-07-03 20:24       ` Kees Cook
2024-07-03 21:28         ` Bart Van Assche
2024-07-03 22:20           ` Kees Cook
2024-07-03 22:33             ` Tejun Heo
2024-06-30 22:26 ` [PATCH 02/53] dmaengine: idxd: Switch to create*_workqueue2() Bart Van Assche
2024-06-30 22:26 ` [PATCH 03/53] drm/amdgpu: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 04/53] media: i2c: adv7511: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 05/53] media: cobalt: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 06/53] media: dm1105: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 07/53] misc: bcm_vk: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 08/53] net: amd-xgbe: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 09/53] net: atlantic: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 10/53] net: mvpp2: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 11/53] remoteproc: stm32: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 12/53] mm/z3fold: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 13/53] usb: typec: tcpm: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 14/53] net/qla3xxx: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 15/53] sfc: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 16/53] wifi: zd1211rw: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 17/53] power: supply: mt6370: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 18/53] remoteproc: imx_rproc: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 19/53] scsi: hisi_sas: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 20/53] scsi: mpt3sas: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 21/53] accel/habanalabs: Simplify the workqueue creation calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 22/53] crypto: safexcel - Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 23/53] pds_core: " Bart Van Assche
2024-07-01 18:49   ` Brett Creeley
2024-07-01 19:53     ` Bart Van Assche
2024-06-30 22:26 ` [PATCH 24/53] net: bna: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 25/53] net/mlx5: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 26/53] net: lan966x: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 27/53] net: sparx5: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 28/53] net: mscc: ocelot: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 29/53] net: qed: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 30/53] net: stmmac: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 31/53] nfc: mrvl: " Bart Van Assche
2024-07-01  9:17   ` Krzysztof Kozlowski
2024-07-01 16:44     ` Bart Van Assche
2024-07-01 16:54   ` Krzysztof Kozlowski
2024-06-30 22:26 ` [PATCH 32/53] scsi: ibmvscsi_tgt: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 33/53] scsi: libsas: Simplify the create*_workqueue() calls Bart Van Assche
2024-07-01  0:15   ` Damien Le Moal
2024-07-01  1:50   ` Jason Yan
2024-06-30 22:26 ` [PATCH 34/53] scsi: mpi3mr: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 35/53] scsi: qedf: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 36/53] scsi: qedi: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 37/53] scsi: qla2xxx: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 38/53] scsi: qla4xxx: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:26 ` [PATCH 39/53] scsi: vmw_pvscsi: " Bart Van Assche
2024-06-30 22:26 ` [PATCH 40/53] scsi: myrb: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:26 ` [PATCH 41/53] scsi: myrs: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 42/53] scsi: stex: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 43/53] scsi: fcoe: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 44/53] scsi: snic: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 45/53] scsi: scsi_transport_fc: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 46/53] scsi: core: Simplify the alloc_workqueue() calls Bart Van Assche
2024-06-30 22:27 ` [PATCH 47/53] serial: max3100: Simplify a create*_workqueue() call Bart Van Assche
2024-08-09 15:21   ` Andy Shevchenko
2024-06-30 22:27 ` [PATCH 48/53] scsi: ufs: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:27 ` [PATCH 49/53] usb: typec: ucsi: Simplify a create*_workqueue() call Bart Van Assche
2024-06-30 22:27 ` [PATCH 50/53] cifs: " Bart Van Assche
2024-06-30 22:27 ` [PATCH 51/53] mac802154: Simplify the create*_workqueue() calls Bart Van Assche
2024-06-30 22:27 ` [PATCH 52/53] nfc: nci: " Bart Van Assche
2024-07-01 16:54   ` Krzysztof Kozlowski
2024-07-01 19:39 ` [PATCH 00/53] Let create*_workqueue() accept a printf-style format string Tejun Heo
2024-07-01 20:13   ` Bart Van Assche
2024-07-01 20:17     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox