drm/xe/devcoredump: Use drm_puts and already cached local variables
authorJohn Harrison <John.C.Harrison@Intel.com>
Thu, 3 Oct 2024 00:46:02 +0000 (17:46 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Tue, 8 Oct 2024 01:12:09 +0000 (18:12 -0700)
There are a bunch of calls to drm_printf with static strings. Switch
them to drm_puts instead.

There are also a bunch of 'coredump->snapshot.XXX' references when
'coredump->snapshot' has alread been cached locally as 'ss'. So use
'ss->XXX' instead.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Julia Filipchuk <julia.filipchuk@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241003004611.2323493-3-John.C.Harrison@Intel.com
drivers/gpu/drm/xe/xe_devcoredump.c

index bdb76e8..d23719d 100644 (file)
@@ -85,9 +85,9 @@ static ssize_t __xe_devcoredump_read(char *buffer, size_t count,
 
        p = drm_coredump_printer(&iter);
 
-       drm_printf(&p, "**** Xe Device Coredump ****\n");
-       drm_printf(&p, "kernel: " UTS_RELEASE "\n");
-       drm_printf(&p, "module: " KBUILD_MODNAME "\n");
+       drm_puts(&p, "**** Xe Device Coredump ****\n");
+       drm_puts(&p, "kernel: " UTS_RELEASE "\n");
+       drm_puts(&p, "module: " KBUILD_MODNAME "\n");
 
        ts = ktime_to_timespec64(ss->snapshot_time);
        drm_printf(&p, "Snapshot time: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec);
@@ -96,20 +96,20 @@ static ssize_t __xe_devcoredump_read(char *buffer, size_t count,
        drm_printf(&p, "Process: %s\n", ss->process_name);
        xe_device_snapshot_print(xe, &p);
 
-       drm_printf(&p, "\n**** GuC CT ****\n");
-       xe_guc_ct_snapshot_print(coredump->snapshot.ct, &p);
-       xe_guc_exec_queue_snapshot_print(coredump->snapshot.ge, &p);
+       drm_puts(&p, "\n**** GuC CT ****\n");
+       xe_guc_ct_snapshot_print(ss->ct, &p);
+       xe_guc_exec_queue_snapshot_print(ss->ge, &p);
 
-       drm_printf(&p, "\n**** Job ****\n");
-       xe_sched_job_snapshot_print(coredump->snapshot.job, &p);
+       drm_puts(&p, "\n**** Job ****\n");
+       xe_sched_job_snapshot_print(ss->job, &p);
 
-       drm_printf(&p, "\n**** HW Engines ****\n");
+       drm_puts(&p, "\n**** HW Engines ****\n");
        for (i = 0; i < XE_NUM_HW_ENGINES; i++)
-               if (coredump->snapshot.hwe[i])
-                       xe_hw_engine_snapshot_print(coredump->snapshot.hwe[i],
-                                                   &p);
-       drm_printf(&p, "\n**** VM state ****\n");
-       xe_vm_snapshot_print(coredump->snapshot.vm, &p);
+               if (ss->hwe[i])
+                       xe_hw_engine_snapshot_print(ss->hwe[i], &p);
+
+       drm_puts(&p, "\n**** VM state ****\n");
+       xe_vm_snapshot_print(ss->vm, &p);
 
        return count - iter.remain;
 }
@@ -247,18 +247,18 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
        if (xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL))
                xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
 
-       coredump->snapshot.ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
-       coredump->snapshot.ge = xe_guc_exec_queue_snapshot_capture(q);
-       coredump->snapshot.job = xe_sched_job_snapshot_capture(job);
-       coredump->snapshot.vm = xe_vm_snapshot_capture(q->vm);
+       ss->ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
+       ss->ge = xe_guc_exec_queue_snapshot_capture(q);
+       ss->job = xe_sched_job_snapshot_capture(job);
+       ss->vm = xe_vm_snapshot_capture(q->vm);
 
        for_each_hw_engine(hwe, q->gt, id) {
                if (hwe->class != q->hwe->class ||
                    !(BIT(hwe->logical_instance) & adj_logical_mask)) {
-                       coredump->snapshot.hwe[id] = NULL;
+                       ss->hwe[id] = NULL;
                        continue;
                }
-               coredump->snapshot.hwe[id] = xe_hw_engine_snapshot_capture(hwe);
+               ss->hwe[id] = xe_hw_engine_snapshot_capture(hwe);
        }
 
        queue_work(system_unbound_wq, &ss->work);