Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

accel/ivpu: Refactor priority_bands_show for readability

Reduce code duplication and improve the overall readability of the debugfs
output for job scheduling priority bands.

Additionally fix clang-tidy warning about missing default case in the
switch statement.

Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Link: https://lore.kernel.org/r/20250915103401.830045-1-karol.wachowski@linux.intel.com

authored by

Jacek Lawrynowicz and committed by
Karol Wachowski
f7e79530 2274402a

+14 -24
+14 -24
drivers/accel/ivpu/ivpu_debugfs.c
··· 398 398 399 399 DEFINE_DEBUGFS_ATTRIBUTE(ivpu_dct_fops, dct_active_get, dct_active_set, "%llu\n"); 400 400 401 + static void print_priority_band(struct seq_file *s, struct ivpu_hw_info *hw, 402 + int band, const char *name) 403 + { 404 + seq_printf(s, "%-9s: grace_period %9u process_grace_period %9u process_quantum %9u\n", 405 + name, 406 + hw->hws.grace_period[band], 407 + hw->hws.process_grace_period[band], 408 + hw->hws.process_quantum[band]); 409 + } 410 + 401 411 static int priority_bands_show(struct seq_file *s, void *v) 402 412 { 403 413 struct ivpu_device *vdev = s->private; 404 414 struct ivpu_hw_info *hw = vdev->hw; 405 415 406 - for (int band = VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE; 407 - band < VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT; band++) { 408 - switch (band) { 409 - case VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE: 410 - seq_puts(s, "Idle: "); 411 - break; 412 - 413 - case VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL: 414 - seq_puts(s, "Normal: "); 415 - break; 416 - 417 - case VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS: 418 - seq_puts(s, "Focus: "); 419 - break; 420 - 421 - case VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME: 422 - seq_puts(s, "Realtime: "); 423 - break; 424 - } 425 - 426 - seq_printf(s, "grace_period %9u process_grace_period %9u process_quantum %9u\n", 427 - hw->hws.grace_period[band], hw->hws.process_grace_period[band], 428 - hw->hws.process_quantum[band]); 429 - } 416 + print_priority_band(s, hw, VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE, "Idle"); 417 + print_priority_band(s, hw, VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL, "Normal"); 418 + print_priority_band(s, hw, VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS, "Focus"); 419 + print_priority_band(s, hw, VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME, "Realtime"); 430 420 431 421 return 0; 432 422 }