lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8d049349b9248a575cc046f248ec3feaf958e2f.1672078853.git.code@siddh.me>
Date:   Mon, 26 Dec 2022 23:57:17 +0530
From:   Siddh Raman Pant <code@...dh.me>
To:     Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Simon Ser <contact@...rsion.fr>,
        Jim Cromie <jim.cromie@...il.com>
Cc:     dri-devel <dri-devel@...ts.freedesktop.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH v3 05/10] drm: Remove usage of deprecated DRM_DEBUG

drm_print.h says DRM_DEBUG is deprecated in favor of drm_dbg_core().

Signed-off-by: Siddh Raman Pant <code@...dh.me>
---
 drivers/gpu/drm/drm_agpsupport.c  |   4 +-
 drivers/gpu/drm/drm_bufs.c        | 114 +++++++++++++++---------------
 drivers/gpu/drm/drm_context.c     |  14 ++--
 drivers/gpu/drm/drm_dma.c         |  10 +--
 drivers/gpu/drm/drm_drv.c         |  10 +--
 drivers/gpu/drm/drm_file.c        |  18 ++---
 drivers/gpu/drm/drm_gem.c         |   5 +-
 drivers/gpu/drm/drm_hashtab.c     |   6 +-
 drivers/gpu/drm/drm_ioc32.c       |  13 ++--
 drivers/gpu/drm/drm_ioctl.c       |  24 +++----
 drivers/gpu/drm/drm_irq.c         |   4 +-
 drivers/gpu/drm/drm_lease.c       |   2 +-
 drivers/gpu/drm/drm_legacy_misc.c |   4 +-
 drivers/gpu/drm/drm_lock.c        |  20 +++---
 drivers/gpu/drm/drm_mode_object.c |   6 +-
 drivers/gpu/drm/drm_pci.c         |  12 ++--
 drivers/gpu/drm/drm_plane.c       |  12 ++--
 drivers/gpu/drm/drm_scatter.c     |  10 +--
 drivers/gpu/drm/drm_syncobj.c     |   2 +-
 drivers/gpu/drm/drm_sysfs.c       |  14 ++--
 drivers/gpu/drm/drm_vm.c          |  43 ++++++-----
 21 files changed, 178 insertions(+), 169 deletions(-)

diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index a4ad6fd13abc..d27686d6e82d 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -315,8 +315,8 @@ int drm_legacy_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
 	if (retcode)
 		return retcode;
 	entry->bound = dev->agp->base + (page << PAGE_SHIFT);
-	DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
-		  dev->agp->base, entry->bound);
+	drm_dbg_core(dev, "base = 0x%lx entry->bound = 0x%lx\n",
+		     dev->agp->base, entry->bound);
 	return 0;
 }
 EXPORT_SYMBOL(drm_legacy_agp_bind);
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 98aaf3379a3b..feedd7c6f0d5 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -171,8 +171,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
 		kfree(map);
 		return -EINVAL;
 	}
-	DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
-		  (unsigned long long)map->offset, map->size, map->type);
+	drm_dbg_core(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
+		     (unsigned long long)map->offset, map->size, map->type);
 
 	/* page-align _DRM_SHM maps. They are allocated here so there is no security
 	 * hole created by that and it works around various broken drivers that use
@@ -205,10 +205,10 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
 		list = drm_find_matching_map(dev, map);
 		if (list != NULL) {
 			if (list->map->size != map->size) {
-				DRM_DEBUG("Matching maps of type %d with "
-					  "mismatched sizes, (%ld vs %ld)\n",
-					  map->type, map->size,
-					  list->map->size);
+				drm_dbg_core(dev, "Matching maps of type %d with "
+					     "mismatched sizes, (%ld vs %ld)\n",
+					     map->type, map->size,
+					     list->map->size);
 				list->map->size = map->size;
 			}
 
@@ -239,9 +239,9 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
 		list = drm_find_matching_map(dev, map);
 		if (list != NULL) {
 			if (list->map->size != map->size) {
-				DRM_DEBUG("Matching maps of type %d with "
-					  "mismatched sizes, (%ld vs %ld)\n",
-					  map->type, map->size, list->map->size);
+				drm_dbg_core(dev, "Matching maps of type %d with "
+					     "mismatched sizes, (%ld vs %ld)\n",
+					     map->type, map->size, list->map->size);
 				list->map->size = map->size;
 			}
 
@@ -250,8 +250,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
 			return 0;
 		}
 		map->handle = vmalloc_user(map->size);
-		DRM_DEBUG("%lu %d %p\n",
-			  map->size, order_base_2(map->size), map->handle);
+		drm_dbg_core(dev, "%lu %d %p\n",
+			     map->size, order_base_2(map->size), map->handle);
 		if (!map->handle) {
 			kfree(map);
 			return -ENOMEM;
@@ -308,8 +308,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
 			kfree(map);
 			return -EPERM;
 		}
-		DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n",
-			  (unsigned long long)map->offset, map->size);
+		drm_dbg_core(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
+			     (unsigned long long)map->offset, map->size);
 
 		break;
 	}
@@ -749,13 +749,13 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
 	byte_count = 0;
 	agp_offset = dev->agp->base + request->agp_start;
 
-	DRM_DEBUG("count:      %d\n", count);
-	DRM_DEBUG("order:      %d\n", order);
-	DRM_DEBUG("size:       %d\n", size);
-	DRM_DEBUG("agp_offset: %lx\n", agp_offset);
-	DRM_DEBUG("alignment:  %d\n", alignment);
-	DRM_DEBUG("page_order: %d\n", page_order);
-	DRM_DEBUG("total:      %d\n", total);
+	drm_dbg_core(dev, "count:      %d\n", count);
+	drm_dbg_core(dev, "order:      %d\n", order);
+	drm_dbg_core(dev, "size:       %d\n", size);
+	drm_dbg_core(dev, "agp_offset: %lx\n", agp_offset);
+	drm_dbg_core(dev, "alignment:  %d\n", alignment);
+	drm_dbg_core(dev, "page_order: %d\n", page_order);
+	drm_dbg_core(dev, "total:      %d\n", total);
 
 	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
 		return -EINVAL;
@@ -770,7 +770,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
 		}
 	}
 	if (!list_empty(&dev->agp->memory) && !valid) {
-		DRM_DEBUG("zone invalid\n");
+		drm_dbg_core(dev, "zone invalid\n");
 		return -EINVAL;
 	}
 	spin_lock(&dev->buf_lock);
@@ -833,14 +833,15 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
 			return -ENOMEM;
 		}
 
-		DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
+		drm_dbg_core(dev, "buffer %d @ %p\n", entry->buf_count,
+			     buf->address);
 
 		offset += alignment;
 		entry->buf_count++;
 		byte_count += PAGE_SIZE << page_order;
 	}
 
-	DRM_DEBUG("byte_count: %d\n", byte_count);
+	drm_dbg_core(dev, "byte_count: %d\n", byte_count);
 
 	temp_buflist = krealloc(dma->buflist,
 				(dma->buf_count + entry->buf_count) *
@@ -863,8 +864,8 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
 	dma->page_count += byte_count >> PAGE_SHIFT;
 	dma->byte_count += byte_count;
 
-	DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
-	DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
+	drm_dbg_core(dev, "dma->buf_count : %d\n", dma->buf_count);
+	drm_dbg_core(dev, "entry->buf_count : %d\n", entry->buf_count);
 
 	mutex_unlock(&dev->struct_mutex);
 
@@ -912,8 +913,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
 	order = order_base_2(request->size);
 	size = 1 << order;
 
-	DRM_DEBUG("count=%d, size=%d (%d), order=%d\n",
-		  request->count, request->size, size, order);
+	drm_dbg_core(dev, "count=%d, size=%d (%d), order=%d\n",
+		     request->count, request->size, size, order);
 
 	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
 		return -EINVAL;
@@ -975,8 +976,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
 	}
 	memcpy(temp_pagelist,
 	       dma->pagelist, dma->page_count * sizeof(*dma->pagelist));
-	DRM_DEBUG("pagelist: %d entries\n",
-		  dma->page_count + (count << page_order));
+	drm_dbg_core(dev, "pagelist: %d entries\n",
+		     dma->page_count + (count << page_order));
 
 	entry->buf_size = size;
 	entry->page_order = page_order;
@@ -1015,9 +1016,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
 		}
 		entry->seglist[entry->seg_count++] = dmah;
 		for (i = 0; i < (1 << page_order); i++) {
-			DRM_DEBUG("page %d @ 0x%08lx\n",
-				  dma->page_count + page_count,
-				  (unsigned long)dmah->vaddr + PAGE_SIZE * i);
+			drm_dbg_core(dev, "page %d @ 0x%08lx\n",
+				     dma->page_count + page_count,
+				     (unsigned long)dmah->vaddr + PAGE_SIZE * i);
 			temp_pagelist[dma->page_count + page_count++]
 				= (unsigned long)dmah->vaddr + PAGE_SIZE * i;
 		}
@@ -1051,8 +1052,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
 				return -ENOMEM;
 			}
 
-			DRM_DEBUG("buffer %d @ %p\n",
-				  entry->buf_count, buf->address);
+			drm_dbg_core(dev, "buffer %d @ %p\n",
+				     entry->buf_count, buf->address);
 		}
 		byte_count += PAGE_SIZE << page_order;
 	}
@@ -1140,13 +1141,13 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
 	byte_count = 0;
 	agp_offset = request->agp_start;
 
-	DRM_DEBUG("count:      %d\n", count);
-	DRM_DEBUG("order:      %d\n", order);
-	DRM_DEBUG("size:       %d\n", size);
-	DRM_DEBUG("agp_offset: %lu\n", agp_offset);
-	DRM_DEBUG("alignment:  %d\n", alignment);
-	DRM_DEBUG("page_order: %d\n", page_order);
-	DRM_DEBUG("total:      %d\n", total);
+	drm_dbg_core(dev, "count:      %d\n", count);
+	drm_dbg_core(dev, "order:      %d\n", order);
+	drm_dbg_core(dev, "size:       %d\n", size);
+	drm_dbg_core(dev, "agp_offset: %lu\n", agp_offset);
+	drm_dbg_core(dev, "alignment:  %d\n", alignment);
+	drm_dbg_core(dev, "page_order: %d\n", page_order);
+	drm_dbg_core(dev, "total:      %d\n", total);
 
 	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
 		return -EINVAL;
@@ -1212,14 +1213,15 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
 			return -ENOMEM;
 		}
 
-		DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
+		drm_dbg_core(dev, "buffer %d @ %p\n", entry->buf_count,
+			     buf->address);
 
 		offset += alignment;
 		entry->buf_count++;
 		byte_count += PAGE_SIZE << page_order;
 	}
 
-	DRM_DEBUG("byte_count: %d\n", byte_count);
+	drm_dbg_core(dev, "byte_count: %d\n", byte_count);
 
 	temp_buflist = krealloc(dma->buflist,
 				(dma->buf_count + entry->buf_count) *
@@ -1242,8 +1244,8 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
 	dma->page_count += byte_count >> PAGE_SHIFT;
 	dma->byte_count += byte_count;
 
-	DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
-	DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
+	drm_dbg_core(dev, "dma->buf_count : %d\n", dma->buf_count);
+	drm_dbg_core(dev, "entry->buf_count : %d\n", entry->buf_count);
 
 	mutex_unlock(&dev->struct_mutex);
 
@@ -1344,7 +1346,7 @@ int __drm_legacy_infobufs(struct drm_device *dev,
 			++count;
 	}
 
-	DRM_DEBUG("count = %d\n", count);
+	drm_dbg_core(dev, "count = %d\n", count);
 
 	if (*p >= count) {
 		for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
@@ -1353,12 +1355,12 @@ int __drm_legacy_infobufs(struct drm_device *dev,
 			if (from->buf_count) {
 				if (f(data, count, from) < 0)
 					return -EFAULT;
-				DRM_DEBUG("%d %d %d %d %d\n",
-					  i,
-					  dma->bufs[i].buf_count,
-					  dma->bufs[i].buf_size,
-					  dma->bufs[i].low_mark,
-					  dma->bufs[i].high_mark);
+				drm_dbg_core(dev, "%d %d %d %d %d\n",
+					     i,
+					     dma->bufs[i].buf_count,
+					     dma->bufs[i].buf_size,
+					     dma->bufs[i].low_mark,
+					     dma->bufs[i].high_mark);
 				++count;
 			}
 		}
@@ -1421,8 +1423,8 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
 	if (!dma)
 		return -EINVAL;
 
-	DRM_DEBUG("%d, %d, %d\n",
-		  request->size, request->low_mark, request->high_mark);
+	drm_dbg_core(dev, "%d, %d, %d\n",
+		     request->size, request->low_mark, request->high_mark);
 	order = order_base_2(request->size);
 	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
 		return -EINVAL;
@@ -1469,7 +1471,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
 	if (!dma)
 		return -EINVAL;
 
-	DRM_DEBUG("%d\n", request->count);
+	drm_dbg_core(dev, "%d\n", request->count);
 	for (i = 0; i < request->count; i++) {
 		if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
 			return -EFAULT;
@@ -1569,7 +1571,7 @@ int __drm_legacy_mapbufs(struct drm_device *dev, void *data, int *p,
 	}
       done:
 	*p = dma->buf_count;
-	DRM_DEBUG("%d buffers, retcode = %d\n", *p, retcode);
+	drm_dbg_core(dev, "%d buffers, retcode = %d\n", *p, retcode);
 
 	return retcode;
 }
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index f6d68fad8311..c52764e98d26 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -280,7 +280,7 @@ static int drm_context_switch(struct drm_device * dev, int old, int new)
 		return -EBUSY;
 	}
 
-	DRM_DEBUG("Context switch from %d to %d\n", old, new);
+	drm_dbg_core(dev, "Context switch from %d to %d\n", old, new);
 
 	if (new == dev->last_context) {
 		clear_bit(0, &dev->context_flag);
@@ -379,9 +379,9 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
 		/* Skip kernel's context and get a new one. */
 		tmp_handle = drm_legacy_ctxbitmap_next(dev);
 	}
-	DRM_DEBUG("%d\n", tmp_handle);
+	drm_dbg_core(dev, "%d\n", tmp_handle);
 	if (tmp_handle < 0) {
-		DRM_DEBUG("Not enough free contexts.\n");
+		drm_dbg_core(dev, "Not enough free contexts.\n");
 		/* Should this return -EBUSY instead? */
 		return tmp_handle;
 	}
@@ -390,7 +390,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
 
 	ctx_entry = kmalloc(sizeof(*ctx_entry), GFP_KERNEL);
 	if (!ctx_entry) {
-		DRM_DEBUG("out of memory\n");
+		drm_dbg_core(dev, "out of memory\n");
 		return -ENOMEM;
 	}
 
@@ -449,7 +449,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
 	    !drm_core_check_feature(dev, DRIVER_LEGACY))
 		return -EOPNOTSUPP;
 
-	DRM_DEBUG("%d\n", ctx->handle);
+	drm_dbg_core(dev, "%d\n", ctx->handle);
 	return drm_context_switch(dev, dev->last_context, ctx->handle);
 }
 
@@ -473,7 +473,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
 	    !drm_core_check_feature(dev, DRIVER_LEGACY))
 		return -EOPNOTSUPP;
 
-	DRM_DEBUG("%d\n", ctx->handle);
+	drm_dbg_core(dev, "%d\n", ctx->handle);
 	drm_context_switch_complete(dev, file_priv, ctx->handle);
 
 	return 0;
@@ -499,7 +499,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
 	    !drm_core_check_feature(dev, DRIVER_LEGACY))
 		return -EOPNOTSUPP;
 
-	DRM_DEBUG("%d\n", ctx->handle);
+	drm_dbg_core(dev, "%d\n", ctx->handle);
 	if (ctx->handle != DRM_KERNEL_CONTEXT) {
 		if (dev->driver->context_dtor)
 			dev->driver->context_dtor(dev, ctx->handle);
diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index eb6b741a6f99..dac137072c33 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -94,11 +94,11 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
 	/* Clear dma buffers */
 	for (i = 0; i <= DRM_MAX_ORDER; i++) {
 		if (dma->bufs[i].seg_count) {
-			DRM_DEBUG("order %d: buf_count = %d,"
-				  " seg_count = %d\n",
-				  i,
-				  dma->bufs[i].buf_count,
-				  dma->bufs[i].seg_count);
+			drm_dbg_core(dev, "order %d: buf_count = %d,"
+				     " seg_count = %d\n",
+				     i,
+				     dma->bufs[i].buf_count,
+				     dma->bufs[i].seg_count);
 			for (j = 0; j < dma->bufs[i].seg_count; j++) {
 				if (dma->bufs[i].seglist[j]) {
 					dmah = dma->bufs[i].seglist[j];
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 5802d714ad8d..f49e3342cca2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -155,7 +155,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
 	unsigned long flags;
 	int ret;
 
-	DRM_DEBUG("\n");
+	drm_dbg_core(dev, "\n");
 
 	minor = *drm_minor_get_slot(dev, type);
 	if (!minor)
@@ -176,7 +176,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
 	idr_replace(&drm_minors_idr, minor, minor->index);
 	spin_unlock_irqrestore(&drm_minor_lock, flags);
 
-	DRM_DEBUG("new minor registered %d\n", minor->index);
+	drm_dbg_core(dev, "new minor registered %d\n", minor->index);
 	return 0;
 
 err_debugfs:
@@ -399,7 +399,7 @@ void drm_minor_release(struct drm_minor *minor)
  */
 void drm_put_dev(struct drm_device *dev)
 {
-	DRM_DEBUG("\n");
+	drm_dbg_core(NULL, "\n");
 
 	if (!dev) {
 		drm_err(NULL, "cleanup called no dev\n");
@@ -1004,7 +1004,7 @@ static int drm_stub_open(struct inode *inode, struct file *filp)
 	struct drm_minor *minor;
 	int err;
 
-	DRM_DEBUG("\n");
+	drm_dbg_core(NULL, "\n");
 
 	minor = drm_minor_acquire(iminor(inode));
 	if (IS_ERR(minor))
@@ -1068,7 +1068,7 @@ static int __init drm_core_init(void)
 
 	drm_core_init_complete = true;
 
-	DRM_DEBUG("Initialized\n");
+	drm_dbg_core(NULL, "Initialized\n");
 	return 0;
 
 error:
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index a8b4d918e9a3..253bf287303c 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -245,10 +245,10 @@ void drm_file_free(struct drm_file *file)
 
 	dev = file->minor->dev;
 
-	DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n",
-		  current->comm, task_pid_nr(current),
-		  (long)old_encode_dev(file->minor->kdev->devt),
-		  atomic_read(&dev->open_count));
+	drm_dbg_core(dev, "comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n",
+		     current->comm, task_pid_nr(current),
+		     (long)old_encode_dev(file->minor->kdev->devt),
+		     atomic_read(&dev->open_count));
 
 #ifdef CONFIG_DRM_LEGACY
 	if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
@@ -340,8 +340,8 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
 	    dev->switch_power_state != DRM_SWITCH_POWER_DYNAMIC_OFF)
 		return -EINVAL;
 
-	DRM_DEBUG("comm=\"%s\", pid=%d, minor=%d\n", current->comm,
-		  task_pid_nr(current), minor->index);
+	drm_dbg_core(dev, "comm=\"%s\", pid=%d, minor=%d\n", current->comm,
+		     task_pid_nr(current), minor->index);
 
 	priv = drm_file_alloc(minor);
 	if (IS_ERR(priv))
@@ -450,11 +450,11 @@ EXPORT_SYMBOL(drm_open);
 
 void drm_lastclose(struct drm_device * dev)
 {
-	DRM_DEBUG("\n");
+	drm_dbg_core(dev, "\n");
 
 	if (dev->driver->lastclose)
 		dev->driver->lastclose(dev);
-	DRM_DEBUG("driver lastclose completed\n");
+	drm_dbg_core(dev, "driver lastclose completed\n");
 
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
 		drm_legacy_dev_reinit(dev);
@@ -485,7 +485,7 @@ int drm_release(struct inode *inode, struct file *filp)
 	if (drm_dev_needs_global_mutex(dev))
 		mutex_lock(&drm_global_mutex);
 
-	DRM_DEBUG("open_count = %d\n", atomic_read(&dev->open_count));
+	drm_dbg_core(dev, "open_count = %d\n", atomic_read(&dev->open_count));
 
 	drm_close_helper(filp);
 
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index c14bff925a12..4434b1de7102 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -712,7 +712,7 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
 
 	if (copy_from_user(handles, bo_handles, count * sizeof(u32))) {
 		ret = -EFAULT;
-		DRM_DEBUG("Failed to copy in GEM handles\n");
+		drm_dbg_core(filp->minor->dev, "Failed to copy in GEM handles\n");
 		goto out;
 	}
 
@@ -767,7 +767,8 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
 
 	obj = drm_gem_object_lookup(filep, handle);
 	if (!obj) {
-		DRM_DEBUG("Failed to look up GEM BO %d\n", handle);
+		drm_dbg_core(filep->minor->dev,
+			     "Failed to look up GEM BO %d\n", handle);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index a1ebf8e056c7..357f20d73b43 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -67,10 +67,12 @@ void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
 	int count = 0;
 
 	hashed_key = hash_long(key, ht->order);
-	DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
+	drm_dbg_core(NULL, "Key is 0x%08lx, Hashed key is 0x%08x\n",
+		     key, hashed_key);
 	h_list = &ht->table[hashed_key];
 	hlist_for_each_entry(entry, h_list, head)
-		DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
+		drm_dbg_core(NULL, "count %d, key: 0x%08lx\n",
+			     count++, entry->key);
 }
 
 static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index 5d82891c3222..115abcccd2f1 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -986,14 +986,15 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	if (!fn)
 		return drm_ioctl(filp, cmd, arg);
 
-	DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, %s\n",
-		  current->comm, task_pid_nr(current),
-		  (long)old_encode_dev(file_priv->minor->kdev->devt),
-		  file_priv->authenticated,
-		  drm_compat_ioctls[nr].name);
+	drm_dbg_core(file_priv->minor->dev,
+		     "comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, %s\n",
+		     current->comm, task_pid_nr(current),
+		     (long)old_encode_dev(file_priv->minor->kdev->devt),
+		     file_priv->authenticated,
+		     drm_compat_ioctls[nr].name);
 	ret = (*fn)(filp, cmd, arg);
 	if (ret)
-		DRM_DEBUG("ret = %d\n", ret);
+		drm_dbg_core(file_priv->minor->dev, "ret = %d\n", ret);
 	return ret;
 }
 EXPORT_SYMBOL(drm_compat_ioctl);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index ca2a6e6101dc..192c4803c3e0 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -440,7 +440,7 @@ static int drm_setversion(struct drm_device *dev, void *data, struct drm_file *f
 int drm_noop(struct drm_device *dev, void *data,
 	     struct drm_file *file_priv)
 {
-	DRM_DEBUG("\n");
+	drm_dbg_core(dev, "\n");
 	return 0;
 }
 EXPORT_SYMBOL(drm_noop);
@@ -856,16 +856,16 @@ long drm_ioctl(struct file *filp,
 		out_size = 0;
 	ksize = max(max(in_size, out_size), drv_size);
 
-	DRM_DEBUG("comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n",
-		  current->comm, task_pid_nr(current),
-		  (long)old_encode_dev(file_priv->minor->kdev->devt),
-		  file_priv->authenticated, ioctl->name);
+	drm_dbg_core(dev, "comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n",
+		     current->comm, task_pid_nr(current),
+		     (long)old_encode_dev(file_priv->minor->kdev->devt),
+		     file_priv->authenticated, ioctl->name);
 
 	/* Do not trust userspace, use our own definition */
 	func = ioctl->func;
 
 	if (unlikely(!func)) {
-		DRM_DEBUG("no function\n");
+		drm_dbg_core(dev, "no function\n");
 		retcode = -EINVAL;
 		goto err_i1;
 	}
@@ -894,16 +894,16 @@ long drm_ioctl(struct file *filp,
 
       err_i1:
 	if (!ioctl)
-		DRM_DEBUG("invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
-			  current->comm, task_pid_nr(current),
-			  (long)old_encode_dev(file_priv->minor->kdev->devt),
-			  file_priv->authenticated, cmd, nr);
+		drm_dbg_core(dev, "invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
+			     current->comm, task_pid_nr(current),
+			     (long)old_encode_dev(file_priv->minor->kdev->devt),
+			     file_priv->authenticated, cmd, nr);
 
 	if (kdata != stack_kdata)
 		kfree(kdata);
 	if (retcode)
-		DRM_DEBUG("comm=\"%s\", pid=%d, ret=%d\n", current->comm,
-			  task_pid_nr(current), retcode);
+		drm_dbg_core(dev, "comm=\"%s\", pid=%d, ret=%d\n", current->comm,
+			     task_pid_nr(current), retcode);
 	return retcode;
 }
 EXPORT_SYMBOL(drm_ioctl);
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index d327638e15ee..e70d6975310c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -78,7 +78,7 @@ static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 		return -EBUSY;
 	dev->irq_enabled = true;
 
-	DRM_DEBUG("irq=%d\n", irq);
+	drm_dbg_core(dev, "irq=%d\n", irq);
 
 	/* Before installing handler */
 	if (dev->driver->irq_preinstall)
@@ -146,7 +146,7 @@ int drm_legacy_irq_uninstall(struct drm_device *dev)
 	if (!irq_enabled)
 		return -EINVAL;
 
-	DRM_DEBUG("irq=%d\n", dev->irq);
+	drm_dbg_core(dev, "irq=%d\n", dev->irq);
 
 	if (drm_core_check_feature(dev, DRIVER_LEGACY))
 		vga_client_unregister(to_pci_dev(dev->dev));
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index d72c2fac0ff1..a4b50fdbaaf7 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -673,7 +673,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
 		count++;
 	}
 
-	DRM_DEBUG("lease holds %d objects\n", count);
+	drm_dbg_core(dev, "lease holds %d objects\n", count);
 	if (ret == 0)
 		arg->count_objects = count;
 
diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
index d4c5434062d7..ad0eef292cb0 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -70,7 +70,7 @@ int drm_legacy_setup(struct drm_device * dev)
 		return ret;
 
 
-	DRM_DEBUG("\n");
+	drm_dbg_core(dev, "\n");
 	return 0;
 }
 
@@ -95,7 +95,7 @@ void drm_legacy_dev_reinit(struct drm_device *dev)
 	dev->last_context = 0;
 	dev->if_version = 0;
 
-	DRM_DEBUG("lastclose completed\n");
+	drm_dbg_core(dev, "lastclose completed\n");
 }
 
 void drm_master_legacy_init(struct drm_master *master)
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 411f75a1ee14..fea573dcb016 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -180,10 +180,10 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
-	DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
-		  lock->context, task_pid_nr(current),
-		  master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
-		  lock->flags);
+	drm_dbg_core(dev, "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+		     lock->context, task_pid_nr(current),
+		     master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
+		     lock->flags);
 
 	add_wait_queue(&master->lock.lock_queue, &entry);
 	spin_lock_bh(&master->lock.spinlock);
@@ -219,8 +219,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
 	__set_current_state(TASK_RUNNING);
 	remove_wait_queue(&master->lock.lock_queue, &entry);
 
-	DRM_DEBUG("%d %s\n", lock->context,
-		  ret ? "interrupted" : "has lock");
+	drm_dbg_core(dev, "%d %s\n", lock->context,
+		     ret ? "interrupted" : "has lock");
 	if (ret) return ret;
 
 	/* don't set the block all signals on the master process for now 
@@ -234,8 +234,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
 	if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
 	{
 		if (dev->driver->dma_quiescent(dev)) {
-			DRM_DEBUG("%d waiting for DMA quiescent\n",
-				  lock->context);
+			drm_dbg_core(dev, "%d waiting for DMA quiescent\n",
+				     lock->context);
 			return -EBUSY;
 		}
 	}
@@ -345,8 +345,8 @@ void drm_legacy_lock_release(struct drm_device *dev, struct file *filp)
 		return;
 
 	if (drm_legacy_i_have_hw_lock(dev, file_priv)) {
-		DRM_DEBUG("File %p released, freeing lock for context %d\n",
-			  filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
+		drm_dbg_core(dev, "File %p released, freeing lock for context %d\n",
+			     filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
 		drm_legacy_lock_free(&file_priv->master->lock,
 				     _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
 	}
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
index ba1608effc0f..6e5a970043fc 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -192,7 +192,8 @@ EXPORT_SYMBOL(drm_mode_object_find);
 void drm_mode_object_put(struct drm_mode_object *obj)
 {
 	if (obj->free_cb) {
-		DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount));
+		drm_dbg_core(NULL, "OBJ ID: %d (%d)\n", obj->id,
+			     kref_read(&obj->refcount));
 		kref_put(&obj->refcount, obj->free_cb);
 	}
 }
@@ -209,7 +210,8 @@ EXPORT_SYMBOL(drm_mode_object_put);
 void drm_mode_object_get(struct drm_mode_object *obj)
 {
 	if (obj->free_cb) {
-		DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount));
+		drm_dbg_core(NULL, "OBJ ID: %d (%d)\n", obj->id,
+			     kref_read(&obj->refcount));
 		kref_get(&obj->refcount);
 	}
 }
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 7dfb837d1325..485ec407a115 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -85,8 +85,8 @@ static int drm_legacy_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_bu
 
 	p->irq = pdev->irq;
 
-	DRM_DEBUG("%d:%d:%d => IRQ %d\n", p->busnum, p->devnum, p->funcnum,
-		  p->irq);
+	drm_dbg_core(dev, "%d:%d:%d => IRQ %d\n",
+		     p->busnum, p->devnum, p->funcnum, p->irq);
 	return 0;
 }
 
@@ -151,12 +151,12 @@ static int drm_legacy_get_pci_dev(struct pci_dev *pdev,
 	struct drm_device *dev;
 	int ret;
 
-	DRM_DEBUG("\n");
-
 	dev = drm_dev_alloc(driver, &pdev->dev);
 	if (IS_ERR(dev))
 		return PTR_ERR(dev);
 
+	drm_dbg_core(dev, "\n");
+
 	ret = pci_enable_device(pdev);
 	if (ret)
 		goto err_free;
@@ -203,7 +203,7 @@ int drm_legacy_pci_init(const struct drm_driver *driver,
 	const struct pci_device_id *pid;
 	int i;
 
-	DRM_DEBUG("\n");
+	drm_dbg_core(NULL, "\n");
 
 	if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
 		return -EINVAL;
@@ -247,7 +247,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver,
 {
 	struct drm_device *dev, *tmp;
 
-	DRM_DEBUG("\n");
+	drm_dbg_core(NULL, "\n");
 
 	if (!(driver->driver_features & DRIVER_LEGACY)) {
 		WARN_ON(1);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index a650f06e4cea..5e3b82bf197a 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1255,17 +1255,19 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		switch (page_flip->flags & DRM_MODE_PAGE_FLIP_TARGET) {
 		case DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE:
 			if ((int)(target_vblank - current_vblank) > 1) {
-				DRM_DEBUG("Invalid absolute flip target %u, "
-					  "must be <= %u\n", target_vblank,
-					  current_vblank + 1);
+				drm_dbg_core(dev,
+					     "Invalid absolute flip target %u, "
+					     "must be <= %u\n", target_vblank,
+					     current_vblank + 1);
 				drm_crtc_vblank_put(crtc);
 				return -EINVAL;
 			}
 			break;
 		case DRM_MODE_PAGE_FLIP_TARGET_RELATIVE:
 			if (target_vblank != 0 && target_vblank != 1) {
-				DRM_DEBUG("Invalid relative flip target %u, "
-					  "must be 0 or 1\n", target_vblank);
+				drm_dbg_core(dev,
+					     "Invalid relative flip target %u, "
+					     "must be 0 or 1\n", target_vblank);
 				drm_crtc_vblank_put(crtc);
 				return -EINVAL;
 			}
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index 5b0b2140d535..08b3eb586484 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -82,7 +82,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
 	struct drm_sg_mem *entry;
 	unsigned long pages, i, j;
 
-	DRM_DEBUG("\n");
+	drm_dbg_core(dev, "\n");
 
 	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
 		return -EOPNOTSUPP;
@@ -101,7 +101,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
 		return -ENOMEM;
 
 	pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
-	DRM_DEBUG("size=%ld pages=%ld\n", request->size, pages);
+	drm_dbg_core(dev, "size=%ld pages=%ld\n", request->size, pages);
 
 	entry->pages = pages;
 	entry->pagelist = kcalloc(pages, sizeof(*entry->pagelist), GFP_KERNEL);
@@ -132,8 +132,8 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
 
 	entry->handle = ScatterHandle((unsigned long)entry->virtual);
 
-	DRM_DEBUG("handle  = %08lx\n", entry->handle);
-	DRM_DEBUG("virtual = %p\n", entry->virtual);
+	drm_dbg_core(dev, "handle  = %08lx\n", entry->handle);
+	drm_dbg_core(dev, "virtual = %p\n", entry->virtual);
 
 	for (i = (unsigned long)entry->virtual, j = 0; j < pages;
 	     i += PAGE_SIZE, j++) {
@@ -213,7 +213,7 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
 	if (!entry || entry->handle != request->handle)
 		return -EINVAL;
 
-	DRM_DEBUG("virtual  = %p\n", entry->virtual);
+	drm_dbg_core(dev, "virtual  = %p\n", entry->virtual);
 
 	drm_sg_cleanup(entry);
 
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 0c2be8360525..e84957a0f319 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -298,7 +298,7 @@ void drm_syncobj_add_point(struct drm_syncobj *syncobj,
 	prev = drm_syncobj_fence_get(syncobj);
 	/* You are adding an unorder point to timeline, which could cause payload returned from query_ioctl is 0! */
 	if (prev && prev->seqno >= point)
-		DRM_DEBUG("You are adding an unorder point to timeline!\n");
+		drm_dbg_core(NULL, "You are adding an unorder point to timeline!\n");
 	dma_fence_chain_init(chain, prev, fence, point);
 	rcu_assign_pointer(syncobj->fence, &chain->base);
 
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 430e00b16eec..ee810d493b6e 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -341,8 +341,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
 	if (r)
 		goto err_free;
 
-	DRM_DEBUG("adding \"%s\" to sysfs\n",
-		  connector->name);
+	drm_dbg_core(dev, "adding \"%s\" to sysfs\n",
+		     connector->name);
 
 	r = device_add(kdev);
 	if (r) {
@@ -370,8 +370,8 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
 	if (connector->ddc)
 		sysfs_remove_link(&connector->kdev->kobj, "ddc");
 
-	DRM_DEBUG("removing \"%s\" from sysfs\n",
-		  connector->name);
+	drm_dbg_core(connector->dev, "removing \"%s\" from sysfs\n",
+		     connector->name);
 
 	device_unregister(connector->kdev);
 	connector->kdev = NULL;
@@ -382,7 +382,7 @@ void drm_sysfs_lease_event(struct drm_device *dev)
 	char *event_string = "LEASE=1";
 	char *envp[] = { event_string, NULL };
 
-	DRM_DEBUG("generating lease event\n");
+	drm_dbg_core(dev, "generating lease event\n");
 
 	kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
 }
@@ -403,7 +403,7 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
 	char *event_string = "HOTPLUG=1";
 	char *envp[] = { event_string, NULL };
 
-	DRM_DEBUG("generating hotplug event\n");
+	drm_dbg_core(dev, "generating hotplug event\n");
 
 	kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
 }
@@ -459,7 +459,7 @@ void drm_sysfs_connector_status_event(struct drm_connector *connector,
 	snprintf(prop_id, ARRAY_SIZE(prop_id),
 		 "PROPERTY=%u", property->base.id);
 
-	DRM_DEBUG("generating connector status event\n");
+	drm_dbg_core(dev, "generating connector status event\n");
 
 	kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
 }
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index cdb956af2079..6349807e8898 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -168,12 +168,11 @@ static vm_fault_t drm_vm_fault(struct vm_fault *vmf)
 		get_page(page);
 		vmf->page = page;
 
-		DRM_DEBUG
-		    ("baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
-		     (unsigned long long)baddr,
-		     agpmem->memory->pages[offset],
-		     (unsigned long long)offset,
-		     page_count(page));
+		drm_dbg_core(dev, "baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
+			     (unsigned long long)baddr,
+			     agpmem->memory->pages[offset],
+			     (unsigned long long)offset,
+			     page_count(page));
 		return 0;
 	}
 vm_fault_error:
@@ -215,7 +214,7 @@ static vm_fault_t drm_vm_shm_fault(struct vm_fault *vmf)
 	get_page(page);
 	vmf->page = page;
 
-	DRM_DEBUG("shm_fault 0x%lx\n", offset);
+	drm_dbg_core(NULL, "shm_fault 0x%lx\n", offset);
 	return 0;
 }
 
@@ -236,8 +235,8 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
 	struct drm_map_list *r_list;
 	int found_maps = 0;
 
-	DRM_DEBUG("0x%08lx,0x%08lx\n",
-		  vma->vm_start, vma->vm_end - vma->vm_start);
+	drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
+		     vma->vm_start, vma->vm_end - vma->vm_start);
 
 	map = vma->vm_private_data;
 
@@ -319,7 +318,7 @@ static vm_fault_t drm_vm_dma_fault(struct vm_fault *vmf)
 	get_page(page);
 	vmf->page = page;
 
-	DRM_DEBUG("dma_fault 0x%lx (page %lu)\n", offset, page_nr);
+	drm_dbg_core(dev, "dma_fault 0x%lx (page %lu)\n", offset, page_nr);
 	return 0;
 }
 
@@ -391,8 +390,8 @@ static void drm_vm_open_locked(struct drm_device *dev,
 {
 	struct drm_vma_entry *vma_entry;
 
-	DRM_DEBUG("0x%08lx,0x%08lx\n",
-		  vma->vm_start, vma->vm_end - vma->vm_start);
+	drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
+		     vma->vm_start, vma->vm_end - vma->vm_start);
 
 	vma_entry = kmalloc(sizeof(*vma_entry), GFP_KERNEL);
 	if (vma_entry) {
@@ -417,8 +416,8 @@ static void drm_vm_close_locked(struct drm_device *dev,
 {
 	struct drm_vma_entry *pt, *temp;
 
-	DRM_DEBUG("0x%08lx,0x%08lx\n",
-		  vma->vm_start, vma->vm_end - vma->vm_start);
+	drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
+		     vma->vm_start, vma->vm_end - vma->vm_start);
 
 	list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
 		if (pt->vma == vma) {
@@ -466,8 +465,8 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
 
 	dev = priv->minor->dev;
 	dma = dev->dma;
-	DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
-		  vma->vm_start, vma->vm_end, vma->vm_pgoff);
+	drm_dbg_core(dev, "start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
+		     vma->vm_start, vma->vm_end, vma->vm_pgoff);
 
 	/* Length must match exact page count */
 	if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
@@ -528,8 +527,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 	resource_size_t offset = 0;
 	struct drm_hash_item *hash;
 
-	DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
-		  vma->vm_start, vma->vm_end, vma->vm_pgoff);
+	drm_dbg_core(dev, "start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
+		     vma->vm_start, vma->vm_end, vma->vm_pgoff);
 
 	if (!priv->authenticated)
 		return -EACCES;
@@ -600,10 +599,10 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 				       vma->vm_end - vma->vm_start,
 				       vma->vm_page_prot))
 			return -EAGAIN;
-		DRM_DEBUG("   Type = %d; start = 0x%lx, end = 0x%lx,"
-			  " offset = 0x%llx\n",
-			  map->type,
-			  vma->vm_start, vma->vm_end, (unsigned long long)(map->offset + offset));
+		drm_dbg_core(dev,
+			     "   Type = %d; start = 0x%lx, end = 0x%lx, offset = 0x%llx\n",
+			     map->type, vma->vm_start, vma->vm_end,
+			     (unsigned long long)(map->offset + offset));
 
 		vma->vm_ops = &drm_vm_ops;
 		break;
-- 
2.35.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ