drm/i915/ring_submission: use drm_device based logging macros.
authorWambui Karuga <wambui.karugax@gmail.com>
Sat, 14 Mar 2020 18:33:42 +0000 (21:33 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 19 Mar 2020 09:34:28 +0000 (11:34 +0200)
Replace the use of printk based drm logging macros to the struct
drm_device based logging macros in i915/gt/intel_ring_submission.c.
This was done using the following semantic patch that transforms based
on the existence of a drm_i915_private device:
@@
identifier fn, T;
@@

fn(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-DRM_INFO(
+drm_info(&T->drm,
...)
|
-DRM_ERROR(
+drm_err(&T->drm,
...)
|
-DRM_WARN(
+drm_warn(&T->drm,
...)
|
-DRM_DEBUG_KMS(
+drm_dbg_kms(&T->drm,
...)
|
-DRM_DEBUG_DRIVER(
+drm_dbg(&T->drm,
...)
|
-DRM_DEBUG_ATOMIC(
+drm_dbg_atomic(&T->drm,
...)
)
...+>
}

@@
identifier fn, T;
@@

fn(...,struct drm_i915_private *T,...) {
<+...
(
-DRM_INFO(
+drm_info(&T->drm,
...)
|
-DRM_ERROR(
+drm_err(&T->drm,
...)
|
-DRM_WARN(
+drm_warn(&T->drm,
...)
|
-DRM_DEBUG_DRIVER(
+drm_dbg(&T->drm,
...)
|
-DRM_DEBUG_KMS(
+drm_dbg_kms(&T->drm,
...)
|
-DRM_DEBUG_ATOMIC(
+drm_dbg_atomic(&T->drm,
...)
)
...+>
}

New checkpatch warnings were fixed manually.

Note that this converts DRM_DEBUG_DRIVER to drm_dbg().

References: https://lists.freedesktop.org/archives/dri-devel/2020-January/253381.html
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200314183344.17603-6-wambui.karugax@gmail.com
drivers/gpu/drm/i915/gt/intel_ring_submission.c

index fdc3f10..d015f7b 100644 (file)
@@ -577,8 +577,9 @@ static void flush_cs_tlb(struct intel_engine_cs *engine)
                                    RING_INSTPM(engine->mmio_base),
                                    INSTPM_SYNC_FLUSH, 0,
                                    1000))
-               DRM_ERROR("%s: wait for SyncFlush to complete for TLB invalidation timed out\n",
-                         engine->name);
+               drm_err(&dev_priv->drm,
+                       "%s: wait for SyncFlush to complete for TLB invalidation timed out\n",
+                       engine->name);
 }
 
 static void ring_setup_status_page(struct intel_engine_cs *engine)
@@ -601,8 +602,9 @@ static bool stop_ring(struct intel_engine_cs *engine)
                                            MODE_IDLE,
                                            MODE_IDLE,
                                            1000)) {
-                       DRM_ERROR("%s : timed out trying to stop ring\n",
-                                 engine->name);
+                       drm_err(&dev_priv->drm,
+                               "%s : timed out trying to stop ring\n",
+                               engine->name);
 
                        /*
                         * Sometimes we observe that the idle flag is not
@@ -661,22 +663,23 @@ static int xcs_resume(struct intel_engine_cs *engine)
        /* WaClearRingBufHeadRegAtInit:ctg,elk */
        if (!stop_ring(engine)) {
                /* G45 ring initialization often fails to reset head to zero */
-               DRM_DEBUG_DRIVER("%s head not reset to zero "
+               drm_dbg(&dev_priv->drm, "%s head not reset to zero "
+                       "ctl %08x head %08x tail %08x start %08x\n",
+                       engine->name,
+                       ENGINE_READ(engine, RING_CTL),
+                       ENGINE_READ(engine, RING_HEAD),
+                       ENGINE_READ(engine, RING_TAIL),
+                       ENGINE_READ(engine, RING_START));
+
+               if (!stop_ring(engine)) {
+                       drm_err(&dev_priv->drm,
+                               "failed to set %s head to zero "
                                "ctl %08x head %08x tail %08x start %08x\n",
                                engine->name,
                                ENGINE_READ(engine, RING_CTL),
                                ENGINE_READ(engine, RING_HEAD),
                                ENGINE_READ(engine, RING_TAIL),
                                ENGINE_READ(engine, RING_START));
-
-               if (!stop_ring(engine)) {
-                       DRM_ERROR("failed to set %s head to zero "
-                                 "ctl %08x head %08x tail %08x start %08x\n",
-                                 engine->name,
-                                 ENGINE_READ(engine, RING_CTL),
-                                 ENGINE_READ(engine, RING_HEAD),
-                                 ENGINE_READ(engine, RING_TAIL),
-                                 ENGINE_READ(engine, RING_START));
                        ret = -EIO;
                        goto out;
                }
@@ -719,7 +722,7 @@ static int xcs_resume(struct intel_engine_cs *engine)
                                    RING_CTL(engine->mmio_base),
                                    RING_VALID, RING_VALID,
                                    50)) {
-               DRM_ERROR("%s initialization failed "
+               drm_err(&dev_priv->drm, "%s initialization failed "
                          "ctl %08x (valid? %d) head %08x [%08x] tail %08x [%08x] start %08x [expected %08x]\n",
                          engine->name,
                          ENGINE_READ(engine, RING_CTL),