Skip to content

Commit 1aa992c

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: Simplify alloc*_workqueue() invocation
Let alloc*_workqueue() format the workqueue name instead of calling snprintf() explicitly. Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Peter Wang <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0ef9b01 commit 1aa992c

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,8 +1785,6 @@ static void ufshcd_remove_clk_scaling_sysfs(struct ufs_hba *hba)
17851785

17861786
static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
17871787
{
1788-
char wq_name[sizeof("ufs_clkscaling_00")];
1789-
17901788
if (!ufshcd_is_clkscaling_supported(hba))
17911789
return;
17921790

@@ -1798,10 +1796,8 @@ static void ufshcd_init_clk_scaling(struct ufs_hba *hba)
17981796
INIT_WORK(&hba->clk_scaling.resume_work,
17991797
ufshcd_clk_scaling_resume_work);
18001798

1801-
snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d",
1802-
hba->host->host_no);
1803-
hba->clk_scaling.workq =
1804-
alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name);
1799+
hba->clk_scaling.workq = alloc_ordered_workqueue(
1800+
"ufs_clkscaling_%d", WQ_MEM_RECLAIM, hba->host->host_no);
18051801

18061802
hba->clk_scaling.is_initialized = true;
18071803
}
@@ -2125,8 +2121,6 @@ static void ufshcd_remove_clk_gating_sysfs(struct ufs_hba *hba)
21252121

21262122
static void ufshcd_init_clk_gating(struct ufs_hba *hba)
21272123
{
2128-
char wq_name[sizeof("ufs_clk_gating_00")];
2129-
21302124
if (!ufshcd_is_clkgating_allowed(hba))
21312125
return;
21322126

@@ -2136,10 +2130,9 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba)
21362130
INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work);
21372131
INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work);
21382132

2139-
snprintf(wq_name, ARRAY_SIZE(wq_name), "ufs_clk_gating_%d",
2140-
hba->host->host_no);
2141-
hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name,
2142-
WQ_MEM_RECLAIM | WQ_HIGHPRI);
2133+
hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(
2134+
"ufs_clk_gating_%d", WQ_MEM_RECLAIM | WQ_HIGHPRI,
2135+
hba->host->host_no);
21432136

21442137
ufshcd_init_clk_gating_sysfs(hba);
21452138

@@ -10376,7 +10369,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1037610369
int err;
1037710370
struct Scsi_Host *host = hba->host;
1037810371
struct device *dev = hba->dev;
10379-
char eh_wq_name[sizeof("ufs_eh_wq_00")];
1038010372

1038110373
/*
1038210374
* dev_set_drvdata() must be called before any callbacks are registered
@@ -10443,9 +10435,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1044310435
hba->max_pwr_info.is_valid = false;
1044410436

1044510437
/* Initialize work queues */
10446-
snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d",
10447-
hba->host->host_no);
10448-
hba->eh_wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, eh_wq_name);
10438+
hba->eh_wq = alloc_ordered_workqueue("ufs_eh_wq_%d", WQ_MEM_RECLAIM,
10439+
hba->host->host_no);
1044910440
if (!hba->eh_wq) {
1045010441
dev_err(hba->dev, "%s: failed to create eh workqueue\n",
1045110442
__func__);

0 commit comments

Comments
 (0)