Re: [PATCH 23/53] pds_core: Simplify a create*_workqueue() call

From: Brett Creeley
Date: Mon Jul 01 2024 - 14:49:51 EST




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@xxxxxxx>
---
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@xxxxxxx>

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);