drm/i915/ggtt: convert to drm_device based logging macros.
authorWambui Karuga <wambui.karugax@gmail.com>
Sat, 14 Mar 2020 18:33:38 +0000 (21:33 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 19 Mar 2020 09:34:04 +0000 (11:34 +0200)
Converts various instances of the printk based drm logging macros to use
the struct drm_device based logging macros in i915/gt/intel_ggtt.c.
This change was done using the following coccinelle script that matches
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-2-wambui.karugax@gmail.com
drivers/gpu/drm/i915/gt/intel_ggtt.c

index 8fcf143..d8944da 100644 (file)
@@ -769,13 +769,13 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, u64 size)
        else
                ggtt->gsm = ioremap_wc(phys_addr, size);
        if (!ggtt->gsm) {
-               DRM_ERROR("Failed to map the ggtt page table\n");
+               drm_err(&i915->drm, "Failed to map the ggtt page table\n");
                return -ENOMEM;
        }
 
        ret = setup_scratch_page(&ggtt->vm, GFP_DMA32);
        if (ret) {
-               DRM_ERROR("Scratch setup failed\n");
+               drm_err(&i915->drm, "Scratch setup failed\n");
                /* iounmap will also get called at remove, but meh */
                iounmap(ggtt->gsm);
                return ret;
@@ -835,7 +835,8 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
        if (!err)
                err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(39));
        if (err)
-               DRM_ERROR("Can't set DMA mask/consistent mask (%d)\n", err);
+               drm_err(&i915->drm,
+                       "Can't set DMA mask/consistent mask (%d)\n", err);
 
        pci_read_config_word(pdev, SNB_GMCH_CTRL, &snb_gmch_ctl);
        if (IS_CHERRYVIEW(i915))
@@ -982,7 +983,8 @@ static int gen6_gmch_probe(struct i915_ggtt *ggtt)
         * just a coarse sanity check.
         */
        if (ggtt->mappable_end < (64<<20) || ggtt->mappable_end > (512<<20)) {
-               DRM_ERROR("Unknown GMADR size (%pa)\n", &ggtt->mappable_end);
+               drm_err(&i915->drm, "Unknown GMADR size (%pa)\n",
+                       &ggtt->mappable_end);
                return -ENXIO;
        }
 
@@ -990,7 +992,8 @@ static int gen6_gmch_probe(struct i915_ggtt *ggtt)
        if (!err)
                err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40));
        if (err)
-               DRM_ERROR("Can't set DMA mask/consistent mask (%d)\n", err);
+               drm_err(&i915->drm,
+                       "Can't set DMA mask/consistent mask (%d)\n", err);
        pci_read_config_word(pdev, SNB_GMCH_CTRL, &snb_gmch_ctl);
 
        size = gen6_get_total_gtt_size(snb_gmch_ctl);
@@ -1037,7 +1040,7 @@ static int i915_gmch_probe(struct i915_ggtt *ggtt)
 
        ret = intel_gmch_probe(i915->bridge_dev, i915->drm.pdev, NULL);
        if (!ret) {
-               DRM_ERROR("failed to set up gmch\n");
+               drm_err(&i915->drm, "failed to set up gmch\n");
                return -EIO;
        }
 
@@ -1085,26 +1088,29 @@ static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)
                return ret;
 
        if ((ggtt->vm.total - 1) >> 32) {
-               DRM_ERROR("We never expected a Global GTT with more than 32bits"
-                         " of address space! Found %lldM!\n",
-                         ggtt->vm.total >> 20);
+               drm_err(&i915->drm,
+                       "We never expected a Global GTT with more than 32bits"
+                       " of address space! Found %lldM!\n",
+                       ggtt->vm.total >> 20);
                ggtt->vm.total = 1ULL << 32;
                ggtt->mappable_end =
                        min_t(u64, ggtt->mappable_end, ggtt->vm.total);
        }
 
        if (ggtt->mappable_end > ggtt->vm.total) {
-               DRM_ERROR("mappable aperture extends past end of GGTT,"
-                         " aperture=%pa, total=%llx\n",
-                         &ggtt->mappable_end, ggtt->vm.total);
+               drm_err(&i915->drm,
+                       "mappable aperture extends past end of GGTT,"
+                       " aperture=%pa, total=%llx\n",
+                       &ggtt->mappable_end, ggtt->vm.total);
                ggtt->mappable_end = ggtt->vm.total;
        }
 
        /* GMADR is the PCI mmio aperture into the global GTT. */
-       DRM_DEBUG_DRIVER("GGTT size = %lluM\n", ggtt->vm.total >> 20);
-       DRM_DEBUG_DRIVER("GMADR size = %lluM\n", (u64)ggtt->mappable_end >> 20);
-       DRM_DEBUG_DRIVER("DSM size = %lluM\n",
-                        (u64)resource_size(&intel_graphics_stolen_res) >> 20);
+       drm_dbg(&i915->drm, "GGTT size = %lluM\n", ggtt->vm.total >> 20);
+       drm_dbg(&i915->drm, "GMADR size = %lluM\n",
+               (u64)ggtt->mappable_end >> 20);
+       drm_dbg(&i915->drm, "DSM size = %lluM\n",
+               (u64)resource_size(&intel_graphics_stolen_res) >> 20);
 
        return 0;
 }