All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
@ 2021-12-30 10:52 Claudio Suarez
  2021-12-30 14:31   ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c kernel test robot
  2021-12-31  9:07 ` Jani Nikula
  0 siblings, 2 replies; 10+ messages in thread
From: Claudio Suarez @ 2021-12-30 10:52 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter


DRM_DEBUG_* and DRM_* log calls are deprecated.
Change them to drm_dbg_* / drm_{err,info,...} calls in drm core
files.

To avoid making a very big patch, this change is split in
smaller patches. This one includes drm_{b,c}*.c

Signed-off-by: Claudio Suarez <cssk@net-c.es>
---
 drivers/gpu/drm/drm_blend.c          |   6 +-
 drivers/gpu/drm/drm_bridge.c         |   6 +-
 drivers/gpu/drm/drm_bufs.c           | 116 +++++++++++++--------------
 drivers/gpu/drm/drm_client_modeset.c | 109 +++++++++++++------------
 drivers/gpu/drm/drm_color_mgmt.c     |   6 +-
 drivers/gpu/drm/drm_connector.c      |  37 +++++----
 drivers/gpu/drm/drm_context.c        |  18 ++---
 drivers/gpu/drm/drm_crtc.c           |  40 ++++-----
 drivers/gpu/drm/drm_crtc_helper.c    |  61 +++++++-------
 9 files changed, 211 insertions(+), 188 deletions(-)

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index ec37cbfabb50..4a988815f998 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -450,7 +450,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
 	int i, n = 0;
 	int ret = 0;
 
-	DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n",
+	drm_dbg_atomic(dev, "[CRTC:%d:%s] calculating normalized zpos values\n",
 			 crtc->base.id, crtc->name);
 
 	states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL);
@@ -469,7 +469,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
 			goto done;
 		}
 		states[n++] = plane_state;
-		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] processing zpos value %d\n",
+		drm_dbg_atomic(dev, "[PLANE:%d:%s] processing zpos value %d\n",
 				 plane->base.id, plane->name,
 				 plane_state->zpos);
 	}
@@ -480,7 +480,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
 		plane = states[i]->plane;
 
 		states[i]->normalized_zpos = i;
-		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] normalized zpos value %d\n",
+		drm_dbg_atomic(dev, "[PLANE:%d:%s] normalized zpos value %d\n",
 				 plane->base.id, plane->name, i);
 	}
 	crtc_state->zpos_changed = true;
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index c96847fc0ebc..b108377b4b40 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -288,10 +288,12 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
 	list_del(&bridge->chain_node);
 
 #ifdef CONFIG_OF
-	DRM_ERROR("failed to attach bridge %pOF to encoder %s: %d\n",
+	drm_err(encoder->dev,
+		  "failed to attach bridge %pOF to encoder %s: %d\n",
 		  bridge->of_node, encoder->name, ret);
 #else
-	DRM_ERROR("failed to attach bridge to encoder %s: %d\n",
+	drm_err(encoder->dev,
+		  "failed to attach bridge to encoder %s: %d\n",
 		  encoder->name, ret);
 #endif
 
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index fcca21e8efac..dd8e100e120c 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_dev_dbg(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,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_dev_dbg(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 +238,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_dev_dbg(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,7 +249,7 @@ 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",
+		drm_dev_dbg(dev, "%lu %d %p\n",
 			  map->size, order_base_2(map->size), map->handle);
 		if (!map->handle) {
 			kfree(map);
@@ -308,7 +307,7 @@ 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",
+		drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
 			  (unsigned long long)map->offset, map->size);
 
 		break;
@@ -749,13 +748,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_dev_dbg(dev, "count:      %d\n", count);
+	drm_dev_dbg(dev, "order:      %d\n", order);
+	drm_dev_dbg(dev, "size:       %d\n", size);
+	drm_dev_dbg(dev, "agp_offset: %lx\n", agp_offset);
+	drm_dev_dbg(dev, "alignment:  %d\n", alignment);
+	drm_dev_dbg(dev, "page_order: %d\n", page_order);
+	drm_dev_dbg(dev, "total:      %d\n", total);
 
 	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
 		return -EINVAL;
@@ -770,7 +769,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
 		}
 	}
 	if (!list_empty(&dev->agp->memory) && !valid) {
-		DRM_DEBUG("zone invalid\n");
+		drm_dev_dbg(dev, "zone invalid\n");
 		return -EINVAL;
 	}
 	spin_lock(&dev->buf_lock);
@@ -833,14 +832,14 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
 			return -ENOMEM;
 		}
 
-		DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
+		drm_dev_dbg(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_dev_dbg(dev, "byte_count: %d\n", byte_count);
 
 	temp_buflist = krealloc(dma->buflist,
 				(dma->buf_count + entry->buf_count) *
@@ -863,8 +862,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_dev_dbg(dev, "dma->buf_count : %d\n", dma->buf_count);
+	drm_dev_dbg(dev, "entry->buf_count : %d\n", entry->buf_count);
 
 	mutex_unlock(&dev->struct_mutex);
 
@@ -912,8 +911,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_dev_dbg(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 +974,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_dev_dbg(dev, "pagelist: %d entries\n",
+		    dma->page_count + (count << page_order));
 
 	entry->buf_size = size;
 	entry->page_order = page_order;
@@ -1015,9 +1014,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_dev_dbg(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 +1050,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
 				return -ENOMEM;
 			}
 
-			DRM_DEBUG("buffer %d @ %p\n",
-				  entry->buf_count, buf->address);
+			drm_dev_dbg(dev, "buffer %d @ %p\n",
+				    entry->buf_count, buf->address);
 		}
 		byte_count += PAGE_SIZE << page_order;
 	}
@@ -1140,13 +1139,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_dev_dbg(dev, "count:      %d\n", count);
+	drm_dev_dbg(dev, "order:      %d\n", order);
+	drm_dev_dbg(dev, "size:       %d\n", size);
+	drm_dev_dbg(dev, "agp_offset: %lu\n", agp_offset);
+	drm_dev_dbg(dev, "alignment:  %d\n", alignment);
+	drm_dev_dbg(dev, "page_order: %d\n", page_order);
+	drm_dev_dbg(dev, "total:      %d\n", total);
 
 	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
 		return -EINVAL;
@@ -1212,14 +1211,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_dev_dbg(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_dev_dbg(dev, "byte_count: %d\n", byte_count);
 
 	temp_buflist = krealloc(dma->buflist,
 				(dma->buf_count + entry->buf_count) *
@@ -1242,8 +1242,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_dev_dbg(dev, "dma->buf_count : %d\n", dma->buf_count);
+	drm_dev_dbg(dev, "entry->buf_count : %d\n", entry->buf_count);
 
 	mutex_unlock(&dev->struct_mutex);
 
@@ -1344,7 +1344,7 @@ int __drm_legacy_infobufs(struct drm_device *dev,
 			++count;
 	}
 
-	DRM_DEBUG("count = %d\n", count);
+	drm_dev_dbg(dev, "count = %d\n", count);
 
 	if (*p >= count) {
 		for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
@@ -1353,12 +1353,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_dev_dbg(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 +1421,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_dev_dbg(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,20 +1469,20 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
 	if (!dma)
 		return -EINVAL;
 
-	DRM_DEBUG("%d\n", request->count);
+	drm_dev_dbg(dev, "%d\n", request->count);
 	for (i = 0; i < request->count; i++) {
 		if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
 			return -EFAULT;
 		if (idx < 0 || idx >= dma->buf_count) {
-			DRM_ERROR("Index %d (of %d max)\n",
-				  idx, dma->buf_count - 1);
+			drm_err(dev, "Index %d (of %d max)\n",
+				idx, dma->buf_count - 1);
 			return -EINVAL;
 		}
 		idx = array_index_nospec(idx, dma->buf_count);
 		buf = dma->buflist[idx];
 		if (buf->file_priv != file_priv) {
-			DRM_ERROR("Process %d freeing buffer not owned\n",
-				  task_pid_nr(current));
+			drm_err(dev, "Process %d freeing buffer not owned\n",
+				task_pid_nr(current));
 			return -EINVAL;
 		}
 		drm_legacy_free_buffer(dev, buf);
@@ -1569,7 +1569,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_dev_dbg(dev, "%d buffers, retcode = %d\n", *p, retcode);
 
 	return retcode;
 }
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..37be434fc48d 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -240,8 +240,8 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
 	for (i = 0; i < connector_count; i++) {
 		connector = connectors[i];
 		enabled[i] = drm_connector_enabled(connector, true);
-		DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
-			      connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+		drm_dbg_kms(connector->dev, "connector %d enabled? %s\n", connector->base.id,
+			    connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
 
 		any_enabled |= enabled[i];
 	}
@@ -301,7 +301,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
 	}
 
 	if (can_clone) {
-		DRM_DEBUG_KMS("can clone using command line\n");
+		drm_dbg_kms(dev, "can clone using command line\n");
 		return true;
 	}
 
@@ -326,10 +326,11 @@ static bool drm_client_target_cloned(struct drm_device *dev,
 	}
 
 	if (can_clone) {
-		DRM_DEBUG_KMS("can clone using 1024x768\n");
+		drm_dbg_kms(dev, "can clone using 1024x768\n");
 		return true;
 	}
-	DRM_INFO("kms: can't enable cloning when we probably wanted to.\n");
+	drm_info(dev,
+		 "kms: can't enable cloning when we probably wanted to.\n");
 	return false;
 }
 
@@ -341,6 +342,7 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
 				       int h_idx, int v_idx)
 {
 	struct drm_connector *connector;
+	struct drm_device *dev = connector_count ? connectors[0]->dev : NULL;
 	int i;
 	int hoffset = 0, voffset = 0;
 
@@ -350,8 +352,8 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
 			continue;
 
 		if (!modes[i] && (h_idx || v_idx)) {
-			DRM_DEBUG_KMS("no modes for connector tiled %d %d\n", i,
-				      connector->base.id);
+			drm_dbg_kms(dev, "no modes for connector tiled %d %d\n",
+				    i, connector->base.id);
 			continue;
 		}
 		if (connector->tile_h_loc < h_idx)
@@ -362,7 +364,7 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
 	}
 	offsets[idx].x = hoffset;
 	offsets[idx].y = voffset;
-	DRM_DEBUG_KMS("returned %d %d for %d %d\n", hoffset, voffset, h_idx, v_idx);
+	drm_dbg_kms(dev, "returned %d %d for %d %d\n", hoffset, voffset, h_idx, v_idx);
 	return 0;
 }
 
@@ -419,14 +421,16 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
 			drm_client_get_tile_offsets(connectors, connector_count, modes, offsets, i,
 						    connector->tile_h_loc, connector->tile_v_loc);
 		}
-		DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
-			      connector->base.id);
+		drm_dbg_kms(connector->dev,
+			    "looking for cmdline mode on connector %d\n",
+			    connector->base.id);
 
 		/* got for command line mode first */
 		modes[i] = drm_connector_pick_cmdline_mode(connector);
 		if (!modes[i]) {
-			DRM_DEBUG_KMS("looking for preferred mode on connector %d %d\n",
-				      connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
+			drm_dbg_kms(connector->dev,
+				    "looking for preferred mode on connector %d %d\n",
+				    connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
 			modes[i] = drm_connector_has_preferred_mode(connector, width, height);
 		}
 		/* No preferred modes, pick one off the list */
@@ -448,16 +452,18 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
 			    (connector->tile_h_loc == 0 &&
 			     connector->tile_v_loc == 0 &&
 			     !drm_connector_get_tiled_mode(connector))) {
-				DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
-					      connector->base.id);
+				drm_dbg_kms(connector->dev,
+					    "Falling back to non tiled mode on Connector %d\n",
+					    connector->base.id);
 				modes[i] = drm_connector_fallback_non_tiled_mode(connector);
 			} else {
 				modes[i] = drm_connector_get_tiled_mode(connector);
 			}
 		}
 
-		DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
-			  "none");
+		drm_dbg_kms(connector->dev,
+			    "found mode %s\n",
+			    modes[i] ? modes[i]->name : "none");
 		conn_configured |= BIT_ULL(i);
 	}
 
@@ -617,15 +623,15 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 			num_connectors_detected++;
 
 		if (!enabled[i]) {
-			DRM_DEBUG_KMS("connector %s not enabled, skipping\n",
-				      connector->name);
+			drm_dbg_kms(dev, "connector %s not enabled, skipping\n",
+				    connector->name);
 			conn_configured |= BIT(i);
 			continue;
 		}
 
 		if (connector->force == DRM_FORCE_OFF) {
-			DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
-				      connector->name);
+			drm_dbg_kms(dev, "connector %s is disabled by user, skipping\n",
+				    connector->name);
 			enabled[i] = false;
 			continue;
 		}
@@ -635,8 +641,8 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 			if (connector->force > DRM_FORCE_OFF)
 				goto bail;
 
-			DRM_DEBUG_KMS("connector %s has no encoder or crtc, skipping\n",
-				      connector->name);
+			drm_dbg_kms(dev, "connector %s has no encoder or crtc, skipping\n",
+				    connector->name);
 			enabled[i] = false;
 			conn_configured |= BIT(i);
 			continue;
@@ -653,28 +659,28 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 		 */
 		for (j = 0; j < count; j++) {
 			if (crtcs[j] == new_crtc) {
-				DRM_DEBUG_KMS("fallback: cloned configuration\n");
+				drm_dbg_kms(dev, "fallback: cloned configuration\n");
 				goto bail;
 			}
 		}
 
-		DRM_DEBUG_KMS("looking for cmdline mode on connector %s\n",
-			      connector->name);
+		drm_dbg_kms(dev, "looking for cmdline mode on connector %s\n",
+			    connector->name);
 
 		/* go for command line mode first */
 		modes[i] = drm_connector_pick_cmdline_mode(connector);
 
 		/* try for preferred next */
 		if (!modes[i]) {
-			DRM_DEBUG_KMS("looking for preferred mode on connector %s %d\n",
-				      connector->name, connector->has_tile);
+			drm_dbg_kms(dev, "looking for preferred mode on connector %s %d\n",
+				    connector->name, connector->has_tile);
 			modes[i] = drm_connector_has_preferred_mode(connector, width, height);
 		}
 
 		/* No preferred mode marked by the EDID? Are there any modes? */
 		if (!modes[i] && !list_empty(&connector->modes)) {
-			DRM_DEBUG_KMS("using first mode listed on connector %s\n",
-				      connector->name);
+			drm_dbg_kms(dev, "using first mode listed on connector %s\n",
+				    connector->name);
 			modes[i] = list_first_entry(&connector->modes,
 						    struct drm_display_mode,
 						    head);
@@ -693,8 +699,8 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 			 * This is crtc->mode and not crtc->state->mode for the
 			 * fastboot check to work correctly.
 			 */
-			DRM_DEBUG_KMS("looking for current mode on connector %s\n",
-				      connector->name);
+			drm_dbg_kms(dev, "looking for current mode on connector %s\n",
+				    connector->name);
 			modes[i] = &connector->state->crtc->mode;
 		}
 		/*
@@ -703,18 +709,18 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 		 */
 		if (connector->has_tile &&
 		    num_tiled_conns < connector->num_h_tile * connector->num_v_tile) {
-			DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
-				      connector->base.id);
+			drm_dbg_kms(dev, "Falling back to non tiled mode on Connector %d\n",
+				    connector->base.id);
 			modes[i] = drm_connector_fallback_non_tiled_mode(connector);
 		}
 		crtcs[i] = new_crtc;
 
-		DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
-			      connector->name,
-			      connector->state->crtc->base.id,
-			      connector->state->crtc->name,
-			      modes[i]->hdisplay, modes[i]->vdisplay,
-			      modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
+		drm_dbg_kms(dev, "connector %s on [CRTC:%d:%s]: %dx%d%s\n",
+			    connector->name,
+			    connector->state->crtc->base.id,
+			    connector->state->crtc->name,
+			    modes[i]->hdisplay, modes[i]->vdisplay,
+			    modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
 
 		fallback = false;
 		conn_configured |= BIT(i);
@@ -730,15 +736,16 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
 	 */
 	if (num_connectors_enabled != num_connectors_detected &&
 	    num_connectors_enabled < dev->mode_config.num_crtc) {
-		DRM_DEBUG_KMS("fallback: Not all outputs enabled\n");
-		DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled,
-			      num_connectors_detected);
+		drm_dbg_kms(dev, "fallback: Not all outputs enabled\n");
+		drm_dbg_kms(dev, "Enabled: %i, detected: %i\n",
+			    num_connectors_enabled,
+			    num_connectors_detected);
 		fallback = true;
 	}
 
 	if (fallback) {
 bail:
-		DRM_DEBUG_KMS("Not using firmware configuration\n");
+		drm_dbg_kms(dev, "Not using firmware configuration\n");
 		memcpy(enabled, save_enabled, count);
 		ret = false;
 	}
@@ -775,7 +782,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
 	int i, ret = 0;
 	bool *enabled;
 
-	DRM_DEBUG_KMS("\n");
+	drm_dbg_kms(dev, "\n");
 
 	if (!width)
 		width = dev->mode_config.max_width;
@@ -806,7 +813,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
 	offsets = kcalloc(connector_count, sizeof(*offsets), GFP_KERNEL);
 	enabled = kcalloc(connector_count, sizeof(bool), GFP_KERNEL);
 	if (!crtcs || !modes || !enabled || !offsets) {
-		DRM_ERROR("Memory allocation failed\n");
+		drm_err(dev, "Memory allocation failed\n");
 		ret = -ENOMEM;
 		goto out;
 	}
@@ -817,7 +824,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
 	for (i = 0; i < connector_count; i++)
 		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
 	if (!total_modes_count)
-		DRM_DEBUG_KMS("No connectors reported connected with modes\n");
+		drm_dbg_kms(dev, "No connectors reported connected with modes\n");
 	drm_client_connectors_enabled(connectors, connector_count, enabled);
 
 	if (!drm_client_firmware_config(client, connectors, connector_count, crtcs,
@@ -830,10 +837,10 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
 					      offsets, enabled, width, height) &&
 		    !drm_client_target_preferred(connectors, connector_count, modes,
 						 offsets, enabled, width, height))
-			DRM_ERROR("Unable to find initial modes\n");
+			drm_err(dev, "Unable to find initial modes\n");
 
-		DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
-			      width, height);
+		drm_dbg_kms(dev, "picking CRTCs for %dx%d config\n",
+			    width, height);
 
 		drm_client_pick_crtcs(client, connectors, connector_count,
 				      crtcs, modes, 0, width, height);
@@ -851,8 +858,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
 			struct drm_mode_set *modeset = drm_client_find_modeset(client, crtc);
 			struct drm_connector *connector = connectors[i];
 
-			DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n",
-				      mode->name, crtc->base.id, offset->x, offset->y);
+			drm_dbg_kms(dev, "desired mode %s set on crtc %d (%d,%d)\n",
+				    mode->name, crtc->base.id, offset->x, offset->y);
 
 			if (WARN_ON_ONCE(modeset->num_connectors == DRM_CLIENT_MAX_CLONED_CONNECTORS ||
 					 (dev->mode_config.num_crtc > 1 && modeset->num_connectors == 1))) {
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index bb14f488c8f6..b2bdb684a1e3 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -608,7 +608,8 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
 		if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) {
 			if (entry[i].red != entry[i].blue ||
 			    entry[i].red != entry[i].green) {
-				DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n");
+				drm_dbg_kms(lut->dev,
+					    "All LUT entries must have equal r/g/b\n");
 				return -EINVAL;
 			}
 		}
@@ -617,7 +618,8 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
 			if (entry[i].red < entry[i - 1].red ||
 			    entry[i].green < entry[i - 1].green ||
 			    entry[i].blue < entry[i - 1].blue) {
-				DRM_DEBUG_KMS("LUT entries must never decrease.\n");
+				drm_dbg_kms(lut->dev,
+					    "LUT entries must never decrease.\n");
 				return -EINVAL;
 			}
 		}
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 52e20c68813b..c9ac42277f3c 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -161,25 +161,28 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
 		return;
 
 	if (mode->force) {
-		DRM_INFO("forcing %s connector %s\n", connector->name,
+		drm_info(connector->dev, "forcing %s connector %s\n",
+			 connector->name,
 			 drm_get_connector_force_name(mode->force));
 		connector->force = mode->force;
 	}
 
 	if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
-		DRM_INFO("cmdline forces connector %s panel_orientation to %d\n",
+		drm_info(connector->dev,
+			 "cmdline forces connector %s panel_orientation to %d\n",
 			 connector->name, mode->panel_orientation);
 		drm_connector_set_panel_orientation(connector,
 						    mode->panel_orientation);
 	}
 
-	DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
-		      connector->name, mode->name,
-		      mode->xres, mode->yres,
-		      mode->refresh_specified ? mode->refresh : 60,
-		      mode->rb ? " reduced blanking" : "",
-		      mode->margins ? " with margins" : "",
-		      mode->interlace ?  " interlaced" : "");
+	drm_dbg_kms(connector->dev,
+		    "cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
+		    connector->name, mode->name,
+		    mode->xres, mode->yres,
+		    mode->refresh_specified ? mode->refresh : 60,
+		    mode->rb ? " reduced blanking" : "",
+		    mode->margins ? " with margins" : "",
+		    mode->interlace ?  " interlaced" : "");
 }
 
 static void drm_connector_free(struct kref *kref)
@@ -251,9 +254,9 @@ int drm_connector_init(struct drm_device *dev,
 	/* connector index is used with 32bit bitmasks */
 	ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL);
 	if (ret < 0) {
-		DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
-			      drm_connector_enum_list[connector_type].name,
-			      ret);
+		drm_dbg_kms(dev, "Failed to allocate %s connector index: %d\n",
+			    drm_connector_enum_list[connector_type].name,
+			    ret);
 		goto out_put;
 	}
 	connector->index = ret;
@@ -2104,12 +2107,14 @@ int drm_connector_update_edid_property(struct drm_connector *connector,
 		old_edid = (const struct edid *)connector->edid_blob_ptr->data;
 		if (old_edid) {
 			if (!drm_edid_are_equal(edid, old_edid)) {
-				DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Edid was changed.\n",
-					      connector->base.id, connector->name);
+				drm_dbg_kms(dev,
+					    "[CONNECTOR:%d:%s] Edid was changed.\n",
+					    connector->base.id, connector->name);
 
 				connector->epoch_counter += 1;
-				DRM_DEBUG_KMS("Updating change counter to %llu\n",
-					      connector->epoch_counter);
+				drm_dbg_kms(dev,
+					    "Updating change counter to %llu\n",
+					    connector->epoch_counter);
 			}
 		}
 	}
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index c6e6a3e7219a..c52764e98d26 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -276,11 +276,11 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
 static int drm_context_switch(struct drm_device * dev, int old, int new)
 {
 	if (test_and_set_bit(0, &dev->context_flag)) {
-		DRM_ERROR("Reentering -- FIXME\n");
+		drm_err(dev, "Reentering -- FIXME\n");
 		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);
@@ -307,7 +307,7 @@ static int drm_context_switch_complete(struct drm_device *dev,
 	dev->last_context = new;	/* PRE/POST: This is the _only_ writer. */
 
 	if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
-		DRM_ERROR("Lock isn't held after context switch\n");
+		drm_err(dev, "Lock isn't held after context switch\n");
 	}
 
 	/* If a context switch is ever initiated
@@ -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_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 26a77a735905..994147abf9eb 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -658,10 +658,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 
 	crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
 	if (!crtc) {
-		DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
+		drm_dbg_kms(dev, "Unknown CRTC ID %d\n", crtc_req->crtc_id);
 		return -ENOENT;
 	}
-	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
+	drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
 	plane = crtc->primary;
 
@@ -684,7 +684,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 				old_fb = plane->fb;
 
 			if (!old_fb) {
-				DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
+				drm_dbg_kms(dev,
+					    "CRTC doesn't have current FB\n");
 				ret = -EINVAL;
 				goto out;
 			}
@@ -695,8 +696,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 		} else {
 			fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id);
 			if (!fb) {
-				DRM_DEBUG_KMS("Unknown FB ID%d\n",
-						crtc_req->fb_id);
+				drm_dbg_kms(dev, "Unknown FB ID%d\n",
+					      crtc_req->fb_id);
 				ret = -ENOENT;
 				goto out;
 			}
@@ -709,7 +710,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 		}
 		if (!file_priv->aspect_ratio_allowed &&
 		    (crtc_req->mode.flags & DRM_MODE_FLAG_PIC_AR_MASK) != DRM_MODE_FLAG_PIC_AR_NONE) {
-			DRM_DEBUG_KMS("Unexpected aspect-ratio flag bits\n");
+			drm_dbg_kms(dev, "Unexpected aspect-ratio flag bits\n");
 			ret = -EINVAL;
 			goto out;
 		}
@@ -717,8 +718,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 
 		ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
 		if (ret) {
-			DRM_DEBUG_KMS("Invalid mode (ret=%d, status=%s)\n",
-				      ret, drm_get_mode_status_name(mode->status));
+			drm_dbg_kms(dev, "Invalid mode (ret=%d, status=%s)\n",
+				    ret, drm_get_mode_status_name(mode->status));
 			drm_mode_debug_printmodeline(mode);
 			goto out;
 		}
@@ -735,9 +736,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 							   fb->format->format,
 							   fb->modifier);
 			if (ret) {
-				DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
-					      &fb->format->format,
-					      fb->modifier);
+				drm_dbg_kms(dev,
+					    "Invalid pixel format %p4cc, modifier 0x%llx\n",
+					    &fb->format->format,
+					    fb->modifier);
 				goto out;
 			}
 		}
@@ -750,14 +752,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 
 	if (crtc_req->count_connectors == 0 && mode) {
-		DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
+		drm_dbg_kms(dev, "Count connectors is 0 but mode set\n");
 		ret = -EINVAL;
 		goto out;
 	}
 
 	if (crtc_req->count_connectors > 0 && (!mode || !fb)) {
-		DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
-			  crtc_req->count_connectors);
+		drm_dbg_kms(dev, "Count connectors is %d but no mode or fb set\n",
+			    crtc_req->count_connectors);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -789,14 +791,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 
 			connector = drm_connector_lookup(dev, file_priv, out_id);
 			if (!connector) {
-				DRM_DEBUG_KMS("Connector id %d unknown\n",
-						out_id);
+				drm_dbg_kms(dev, "Connector id %d unknown\n",
+					    out_id);
 				ret = -ENOENT;
 				goto out;
 			}
-			DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
-					connector->base.id,
-					connector->name);
+			drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n",
+				    connector->base.id,
+				    connector->name);
 
 			connector_set[i] = connector;
 		}
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index bff917531f33..3a94e4067998 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -326,7 +326,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 		if (encoder_funcs->mode_fixup) {
 			if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
 							      adjusted_mode))) {
-				DRM_DEBUG_KMS("Encoder fixup failed\n");
+				drm_dbg_kms(dev, "Encoder fixup failed\n");
 				goto done;
 			}
 		}
@@ -335,11 +335,11 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 	if (crtc_funcs->mode_fixup) {
 		if (!(ret = crtc_funcs->mode_fixup(crtc, mode,
 						adjusted_mode))) {
-			DRM_DEBUG_KMS("CRTC fixup failed\n");
+			drm_dbg_kms(dev, "CRTC fixup failed\n");
 			goto done;
 		}
 	}
-	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
+	drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
 	crtc->hwmode = *adjusted_mode;
 
@@ -378,7 +378,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 		if (!encoder_funcs)
 			continue;
 
-		DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%s]\n",
+		drm_dbg_kms(dev, "[ENCODER:%d:%s] set [MODE:%s]\n",
 			encoder->base.id, encoder->name, mode->name);
 		if (encoder_funcs->mode_set)
 			encoder_funcs->mode_set(encoder, mode, adjusted_mode);
@@ -529,8 +529,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 	int ret;
 	int i;
 
-	DRM_DEBUG_KMS("\n");
-
 	BUG_ON(!set);
 	BUG_ON(!set->crtc);
 	BUG_ON(!set->crtc->helper_private);
@@ -542,19 +540,23 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 	crtc_funcs = set->crtc->helper_private;
 
 	dev = set->crtc->dev;
+
+	drm_dbg_kms(dev, "\n");
+
 	WARN_ON(drm_drv_uses_atomic_modeset(dev));
 
 	if (!set->mode)
 		set->fb = NULL;
 
 	if (set->fb) {
-		DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
-			      set->crtc->base.id, set->crtc->name,
-			      set->fb->base.id,
-			      (int)set->num_connectors, set->x, set->y);
+		drm_dbg_kms(dev,
+			    "[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
+			    set->crtc->base.id, set->crtc->name,
+			    set->fb->base.id,
+			    (int)set->num_connectors, set->x, set->y);
 	} else {
-		DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n",
-			      set->crtc->base.id, set->crtc->name);
+		drm_dbg_kms(dev, "[CRTC:%d:%s] [NOFB]\n",
+			    set->crtc->base.id, set->crtc->name);
 		drm_crtc_helper_disable(set->crtc);
 		return 0;
 	}
@@ -604,7 +606,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 	if (set->crtc->primary->fb != set->fb) {
 		/* If we have no fb then treat it as a full mode set */
 		if (set->crtc->primary->fb == NULL) {
-			DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
+			drm_dbg_kms(dev, "crtc has no fb, full mode set\n");
 			mode_changed = true;
 		} else if (set->fb->format != set->crtc->primary->fb->format) {
 			mode_changed = true;
@@ -616,7 +618,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 		fb_changed = true;
 
 	if (!drm_mode_equal(set->mode, &set->crtc->mode)) {
-		DRM_DEBUG_KMS("modes are different, full mode set\n");
+		drm_dbg_kms(dev, "modes are different, full mode set\n");
 		drm_mode_debug_printmodeline(&set->crtc->mode);
 		drm_mode_debug_printmodeline(set->mode);
 		mode_changed = true;
@@ -652,7 +654,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 					fail = 1;
 
 				if (connector->dpms != DRM_MODE_DPMS_ON) {
-					DRM_DEBUG_KMS("connector dpms not on, full mode switch\n");
+					drm_dbg_kms(dev,
+						    "connector dpms not on, full mode switch\n");
 					mode_changed = true;
 				}
 
@@ -661,7 +664,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 		}
 
 		if (new_encoder != connector->encoder) {
-			DRM_DEBUG_KMS("encoder changed, full mode switch\n");
+			drm_dbg_kms(dev, "encoder changed, full mode switch\n");
 			mode_changed = true;
 			/* If the encoder is reused for another connector, then
 			 * the appropriate crtc will be set later.
@@ -702,17 +705,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 			goto fail;
 		}
 		if (new_crtc != connector->encoder->crtc) {
-			DRM_DEBUG_KMS("crtc changed, full mode switch\n");
+			drm_dbg_kms(dev, "crtc changed, full mode switch\n");
 			mode_changed = true;
 			connector->encoder->crtc = new_crtc;
 		}
 		if (new_crtc) {
-			DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
-				      connector->base.id, connector->name,
-				      new_crtc->base.id, new_crtc->name);
+			drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
+				    connector->base.id, connector->name,
+				    new_crtc->base.id, new_crtc->name);
 		} else {
-			DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [NOCRTC]\n",
-				      connector->base.id, connector->name);
+			drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [NOCRTC]\n",
+				    connector->base.id, connector->name);
 		}
 	}
 	drm_connector_list_iter_end(&conn_iter);
@@ -723,22 +726,23 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 
 	if (mode_changed) {
 		if (drm_helper_crtc_in_use(set->crtc)) {
-			DRM_DEBUG_KMS("attempting to set mode from"
+			drm_dbg_kms(dev, "attempting to set mode from"
 					" userspace\n");
 			drm_mode_debug_printmodeline(set->mode);
 			set->crtc->primary->fb = set->fb;
 			if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
 						      set->x, set->y,
 						      save_set.fb)) {
-				DRM_ERROR("failed to set mode on [CRTC:%d:%s]\n",
+				drm_err(dev, "failed to set mode on [CRTC:%d:%s]\n",
 					  set->crtc->base.id, set->crtc->name);
 				set->crtc->primary->fb = save_set.fb;
 				ret = -EINVAL;
 				goto fail;
 			}
-			DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
+			drm_dbg_kms(dev, "Setting connector DPMS state to on\n");
 			for (i = 0; i < set->num_connectors; i++) {
-				DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id,
+				drm_dbg_kms(dev, "\t[CONNECTOR:%d:%s] set DPMS on\n",
+					      set->connectors[i]->base.id,
 					      set->connectors[i]->name);
 				set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
 			}
@@ -788,7 +792,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
 	if (mode_changed &&
 	    !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x,
 				      save_set.y, save_set.fb))
-		DRM_ERROR("failed to restore config after modeset failure\n");
+		drm_err(dev,
+			  "failed to restore config after modeset failure\n");
 
 	kfree(save_connector_encoders);
 	kfree(save_encoder_crtcs);
@@ -958,7 +963,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev)
 
 		/* Restoring the old config should never fail! */
 		if (ret == false)
-			DRM_ERROR("failed to set mode on crtc %p\n", crtc);
+			drm_err(dev, "failed to set mode on crtc %p\n", crtc);
 
 		/* Turn off outputs that were already powered off */
 		if (drm_helper_choose_crtc_dpms(crtc)) {
-- 
2.34.1




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
  2021-12-30 10:52 [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Claudio Suarez
@ 2021-12-30 14:31   ` kernel test robot
  2021-12-31  9:07 ` Jani Nikula
  1 sibling, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-12-30 14:31 UTC (permalink / raw)
  To: Claudio Suarez, dri-devel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter
  Cc: llvm, kbuild-all

Hi Claudio,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-intel/for-linux-next drm-tip/drm-tip v5.16-rc7 next-20211224]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: hexagon-randconfig-r041-20211230 (https://download.01.org/0day-ci/archive/20211230/202112302236.ikd2ET5w-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project cd284b7ac0615afc6e0f1a30da2777e361de27a3)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
        git checkout 9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/drm_bufs.c:174:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
>> drivers/gpu/drm/drm_bufs.c:174:19: warning: incompatible pointer to integer conversion passing 'char[46]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:175:7: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
                       (unsigned long long)map->offset, map->size, map->type);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:208:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                                   drm_dev_dbg(dev,
                                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:209:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                                               "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:210:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
                                               map->type, map->size, list->map->size);
                                               ^~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:241:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                                   drm_dev_dbg(dev,
                                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:242:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                                               "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:243:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
                                               map->type, map->size, list->map->size);
                                               ^~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:252:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                   drm_dev_dbg(dev, "%lu %d %p\n",
                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:252:20: warning: incompatible pointer to integer conversion passing 'char[11]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                   drm_dev_dbg(dev, "%lu %d %p\n",
                                    ^~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:253:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
                             map->size, order_base_2(map->size), map->handle);
                             ^~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:310:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                   drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:310:20: warning: incompatible pointer to integer conversion passing 'char[39]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                   drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:311:6: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
                             (unsigned long long)map->offset, map->size);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:914:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:914:19: warning: incompatible pointer to integer conversion passing 'char[34]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:915:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                       request->count, request->size, size, order);
                       ^~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:977:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "pagelist: %d entries\n",
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:977:19: warning: incompatible pointer to integer conversion passing 'char[22]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "pagelist: %d entries\n",
                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:978:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                       dma->page_count + (count << page_order));
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1017:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                           drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
                                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1017:21: warning: incompatible pointer to integer conversion passing 'char[19]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                           drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
                                            ^~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1018:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                                       dma->page_count + page_count,
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1053:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                           drm_dev_dbg(dev, "buffer %d @ %p\n",
                                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1053:21: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                           drm_dev_dbg(dev, "buffer %d @ %p\n",
                                            ^~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1054:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                                       entry->buf_count, buf->address);
                                       ^~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1142:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "count:      %d\n", count);
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1142:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "count:      %d\n", count);
                            ^~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1142:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
           drm_dev_dbg(dev, "count:      %d\n", count);
                                                ^~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1143:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "order:      %d\n", order);
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1143:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "order:      %d\n", order);
                            ^~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1143:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
           drm_dev_dbg(dev, "order:      %d\n", order);
                                                ^~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1144:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "size:       %d\n", size);
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,


vim +174 drivers/gpu/drm/drm_bufs.c

   138	
   139	/*
   140	 * Core function to create a range of memory available for mapping by a
   141	 * non-root process.
   142	 *
   143	 * Adjusts the memory offset to its absolute value according to the mapping
   144	 * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
   145	 * applicable and if supported by the kernel.
   146	 */
   147	static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
   148				   unsigned int size, enum drm_map_type type,
   149				   enum drm_map_flags flags,
   150				   struct drm_map_list **maplist)
   151	{
   152		struct drm_local_map *map;
   153		struct drm_map_list *list;
   154		unsigned long user_token;
   155		int ret;
   156	
   157		map = kmalloc(sizeof(*map), GFP_KERNEL);
   158		if (!map)
   159			return -ENOMEM;
   160	
   161		map->offset = offset;
   162		map->size = size;
   163		map->flags = flags;
   164		map->type = type;
   165	
   166		/* Only allow shared memory to be removable since we only keep enough
   167		 * book keeping information about shared memory to allow for removal
   168		 * when processes fork.
   169		 */
   170		if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
   171			kfree(map);
   172			return -EINVAL;
   173		}
 > 174		drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
 > 175			    (unsigned long long)map->offset, map->size, map->type);
   176	
   177		/* page-align _DRM_SHM maps. They are allocated here so there is no security
   178		 * hole created by that and it works around various broken drivers that use
   179		 * a non-aligned quantity to map the SAREA. --BenH
   180		 */
   181		if (map->type == _DRM_SHM)
   182			map->size = PAGE_ALIGN(map->size);
   183	
   184		if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
   185			kfree(map);
   186			return -EINVAL;
   187		}
   188		map->mtrr = -1;
   189		map->handle = NULL;
   190	
   191		switch (map->type) {
   192		case _DRM_REGISTERS:
   193		case _DRM_FRAME_BUFFER:
   194	#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__arm__)
   195			if (map->offset + (map->size-1) < map->offset ||
   196			    map->offset < virt_to_phys(high_memory)) {
   197				kfree(map);
   198				return -EINVAL;
   199			}
   200	#endif
   201			/* Some drivers preinitialize some maps, without the X Server
   202			 * needing to be aware of it.  Therefore, we just return success
   203			 * when the server tries to create a duplicate map.
   204			 */
   205			list = drm_find_matching_map(dev, map);
   206			if (list != NULL) {
   207				if (list->map->size != map->size) {
   208					drm_dev_dbg(dev,
   209						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
 > 210						    map->type, map->size, list->map->size);
   211					list->map->size = map->size;
   212				}
   213	
   214				kfree(map);
   215				*maplist = list;
   216				return 0;
   217			}
   218	
   219			if (map->type == _DRM_FRAME_BUFFER ||
   220			    (map->flags & _DRM_WRITE_COMBINING)) {
   221				map->mtrr =
   222					arch_phys_wc_add(map->offset, map->size);
   223			}
   224			if (map->type == _DRM_REGISTERS) {
   225				if (map->flags & _DRM_WRITE_COMBINING)
   226					map->handle = ioremap_wc(map->offset,
   227								 map->size);
   228				else
   229					map->handle = ioremap(map->offset, map->size);
   230				if (!map->handle) {
   231					kfree(map);
   232					return -ENOMEM;
   233				}
   234			}
   235	
   236			break;
   237		case _DRM_SHM:
   238			list = drm_find_matching_map(dev, map);
   239			if (list != NULL) {
   240				if (list->map->size != map->size) {
   241					drm_dev_dbg(dev,
   242						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
   243						    map->type, map->size, list->map->size);
   244					list->map->size = map->size;
   245				}
   246	
   247				kfree(map);
   248				*maplist = list;
   249				return 0;
   250			}
   251			map->handle = vmalloc_user(map->size);
   252			drm_dev_dbg(dev, "%lu %d %p\n",
 > 253				  map->size, order_base_2(map->size), map->handle);
   254			if (!map->handle) {
   255				kfree(map);
   256				return -ENOMEM;
   257			}
   258			map->offset = (unsigned long)map->handle;
   259			if (map->flags & _DRM_CONTAINS_LOCK) {
   260				/* Prevent a 2nd X Server from creating a 2nd lock */
   261				if (dev->master->lock.hw_lock != NULL) {
   262					vfree(map->handle);
   263					kfree(map);
   264					return -EBUSY;
   265				}
   266				dev->sigdata.lock = dev->master->lock.hw_lock = map->handle;	/* Pointer to lock */
   267			}
   268			break;
   269		case _DRM_AGP: {
   270			struct drm_agp_mem *entry;
   271			int valid = 0;
   272	
   273			if (!dev->agp) {
   274				kfree(map);
   275				return -EINVAL;
   276			}
   277	#ifdef __alpha__
   278			map->offset += dev->hose->mem_space->start;
   279	#endif
   280			/* In some cases (i810 driver), user space may have already
   281			 * added the AGP base itself, because dev->agp->base previously
   282			 * only got set during AGP enable.  So, only add the base
   283			 * address if the map's offset isn't already within the
   284			 * aperture.
   285			 */
   286			if (map->offset < dev->agp->base ||
   287			    map->offset > dev->agp->base +
   288			    dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
   289				map->offset += dev->agp->base;
   290			}
   291			map->mtrr = dev->agp->agp_mtrr;	/* for getmap */
   292	
   293			/* This assumes the DRM is in total control of AGP space.
   294			 * It's not always the case as AGP can be in the control
   295			 * of user space (i.e. i810 driver). So this loop will get
   296			 * skipped and we double check that dev->agp->memory is
   297			 * actually set as well as being invalid before EPERM'ing
   298			 */
   299			list_for_each_entry(entry, &dev->agp->memory, head) {
   300				if ((map->offset >= entry->bound) &&
   301				    (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
   302					valid = 1;
   303					break;
   304				}
   305			}
   306			if (!list_empty(&dev->agp->memory) && !valid) {
   307				kfree(map);
   308				return -EPERM;
   309			}
   310			drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
   311				  (unsigned long long)map->offset, map->size);
   312	
   313			break;
   314		}
   315		case _DRM_SCATTER_GATHER:
   316			if (!dev->sg) {
   317				kfree(map);
   318				return -EINVAL;
   319			}
   320			map->offset += (unsigned long)dev->sg->virtual;
   321			break;
   322		case _DRM_CONSISTENT:
   323			/* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
   324			 * As we're limiting the address to 2^32-1 (or less),
   325			 * casting it down to 32 bits is no problem, but we
   326			 * need to point to a 64bit variable first.
   327			 */
   328			map->handle = dma_alloc_coherent(dev->dev,
   329							 map->size,
   330							 &map->offset,
   331							 GFP_KERNEL);
   332			if (!map->handle) {
   333				kfree(map);
   334				return -ENOMEM;
   335			}
   336			break;
   337		default:
   338			kfree(map);
   339			return -EINVAL;
   340		}
   341	
   342		list = kzalloc(sizeof(*list), GFP_KERNEL);
   343		if (!list) {
   344			if (map->type == _DRM_REGISTERS)
   345				iounmap(map->handle);
   346			kfree(map);
   347			return -EINVAL;
   348		}
   349		list->map = map;
   350	
   351		mutex_lock(&dev->struct_mutex);
   352		list_add(&list->head, &dev->maplist);
   353	
   354		/* Assign a 32-bit handle */
   355		/* We do it here so that dev->struct_mutex protects the increment */
   356		user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
   357			map->offset;
   358		ret = drm_map_handle(dev, &list->hash, user_token, 0,
   359				     (map->type == _DRM_SHM));
   360		if (ret) {
   361			if (map->type == _DRM_REGISTERS)
   362				iounmap(map->handle);
   363			kfree(map);
   364			kfree(list);
   365			mutex_unlock(&dev->struct_mutex);
   366			return ret;
   367		}
   368	
   369		list->user_token = list->hash.key << PAGE_SHIFT;
   370		mutex_unlock(&dev->struct_mutex);
   371	
   372		if (!(map->flags & _DRM_DRIVER))
   373			list->master = dev->master;
   374		*maplist = list;
   375		return 0;
   376	}
   377	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c
@ 2021-12-30 14:31   ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-12-30 14:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 27650 bytes --]

Hi Claudio,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-intel/for-linux-next drm-tip/drm-tip v5.16-rc7 next-20211224]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: hexagon-randconfig-r041-20211230 (https://download.01.org/0day-ci/archive/20211230/202112302236.ikd2ET5w-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project cd284b7ac0615afc6e0f1a30da2777e361de27a3)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
        git checkout 9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/drm_bufs.c:174:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
>> drivers/gpu/drm/drm_bufs.c:174:19: warning: incompatible pointer to integer conversion passing 'char[46]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:175:7: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
                       (unsigned long long)map->offset, map->size, map->type);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:208:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                                   drm_dev_dbg(dev,
                                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:209:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                                               "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:210:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
                                               map->type, map->size, list->map->size);
                                               ^~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:241:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                                   drm_dev_dbg(dev,
                                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:242:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                                               "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:243:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
                                               map->type, map->size, list->map->size);
                                               ^~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:252:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                   drm_dev_dbg(dev, "%lu %d %p\n",
                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:252:20: warning: incompatible pointer to integer conversion passing 'char[11]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                   drm_dev_dbg(dev, "%lu %d %p\n",
                                    ^~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:253:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
                             map->size, order_base_2(map->size), map->handle);
                             ^~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:310:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                   drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
                               ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:310:20: warning: incompatible pointer to integer conversion passing 'char[39]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                   drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:311:6: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
                             (unsigned long long)map->offset, map->size);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:914:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:914:19: warning: incompatible pointer to integer conversion passing 'char[34]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
>> drivers/gpu/drm/drm_bufs.c:915:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                       request->count, request->size, size, order);
                       ^~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:977:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "pagelist: %d entries\n",
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:977:19: warning: incompatible pointer to integer conversion passing 'char[22]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "pagelist: %d entries\n",
                            ^~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:978:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                       dma->page_count + (count << page_order));
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1017:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                           drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
                                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1017:21: warning: incompatible pointer to integer conversion passing 'char[19]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                           drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
                                            ^~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1018:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                                       dma->page_count + page_count,
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1053:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
                           drm_dev_dbg(dev, "buffer %d @ %p\n",
                                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1053:21: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
                           drm_dev_dbg(dev, "buffer %d @ %p\n",
                                            ^~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1054:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                                       entry->buf_count, buf->address);
                                       ^~~~~~~~~~~~~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1142:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "count:      %d\n", count);
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1142:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "count:      %d\n", count);
                            ^~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1142:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
           drm_dev_dbg(dev, "count:      %d\n", count);
                                                ^~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1143:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "order:      %d\n", order);
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                         ^
   drivers/gpu/drm/drm_bufs.c:1143:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
           drm_dev_dbg(dev, "order:      %d\n", order);
                            ^~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
                                                                      ^
   drivers/gpu/drm/drm_bufs.c:1143:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
           drm_dev_dbg(dev, "order:      %d\n", order);
                                                ^~~~~
   include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
                    const char *format, ...);
                                ^
   drivers/gpu/drm/drm_bufs.c:1144:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
           drm_dev_dbg(dev, "size:       %d\n", size);
                       ^~~
   include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
   void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,


vim +174 drivers/gpu/drm/drm_bufs.c

   138	
   139	/*
   140	 * Core function to create a range of memory available for mapping by a
   141	 * non-root process.
   142	 *
   143	 * Adjusts the memory offset to its absolute value according to the mapping
   144	 * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
   145	 * applicable and if supported by the kernel.
   146	 */
   147	static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
   148				   unsigned int size, enum drm_map_type type,
   149				   enum drm_map_flags flags,
   150				   struct drm_map_list **maplist)
   151	{
   152		struct drm_local_map *map;
   153		struct drm_map_list *list;
   154		unsigned long user_token;
   155		int ret;
   156	
   157		map = kmalloc(sizeof(*map), GFP_KERNEL);
   158		if (!map)
   159			return -ENOMEM;
   160	
   161		map->offset = offset;
   162		map->size = size;
   163		map->flags = flags;
   164		map->type = type;
   165	
   166		/* Only allow shared memory to be removable since we only keep enough
   167		 * book keeping information about shared memory to allow for removal
   168		 * when processes fork.
   169		 */
   170		if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
   171			kfree(map);
   172			return -EINVAL;
   173		}
 > 174		drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
 > 175			    (unsigned long long)map->offset, map->size, map->type);
   176	
   177		/* page-align _DRM_SHM maps. They are allocated here so there is no security
   178		 * hole created by that and it works around various broken drivers that use
   179		 * a non-aligned quantity to map the SAREA. --BenH
   180		 */
   181		if (map->type == _DRM_SHM)
   182			map->size = PAGE_ALIGN(map->size);
   183	
   184		if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
   185			kfree(map);
   186			return -EINVAL;
   187		}
   188		map->mtrr = -1;
   189		map->handle = NULL;
   190	
   191		switch (map->type) {
   192		case _DRM_REGISTERS:
   193		case _DRM_FRAME_BUFFER:
   194	#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__arm__)
   195			if (map->offset + (map->size-1) < map->offset ||
   196			    map->offset < virt_to_phys(high_memory)) {
   197				kfree(map);
   198				return -EINVAL;
   199			}
   200	#endif
   201			/* Some drivers preinitialize some maps, without the X Server
   202			 * needing to be aware of it.  Therefore, we just return success
   203			 * when the server tries to create a duplicate map.
   204			 */
   205			list = drm_find_matching_map(dev, map);
   206			if (list != NULL) {
   207				if (list->map->size != map->size) {
   208					drm_dev_dbg(dev,
   209						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
 > 210						    map->type, map->size, list->map->size);
   211					list->map->size = map->size;
   212				}
   213	
   214				kfree(map);
   215				*maplist = list;
   216				return 0;
   217			}
   218	
   219			if (map->type == _DRM_FRAME_BUFFER ||
   220			    (map->flags & _DRM_WRITE_COMBINING)) {
   221				map->mtrr =
   222					arch_phys_wc_add(map->offset, map->size);
   223			}
   224			if (map->type == _DRM_REGISTERS) {
   225				if (map->flags & _DRM_WRITE_COMBINING)
   226					map->handle = ioremap_wc(map->offset,
   227								 map->size);
   228				else
   229					map->handle = ioremap(map->offset, map->size);
   230				if (!map->handle) {
   231					kfree(map);
   232					return -ENOMEM;
   233				}
   234			}
   235	
   236			break;
   237		case _DRM_SHM:
   238			list = drm_find_matching_map(dev, map);
   239			if (list != NULL) {
   240				if (list->map->size != map->size) {
   241					drm_dev_dbg(dev,
   242						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
   243						    map->type, map->size, list->map->size);
   244					list->map->size = map->size;
   245				}
   246	
   247				kfree(map);
   248				*maplist = list;
   249				return 0;
   250			}
   251			map->handle = vmalloc_user(map->size);
   252			drm_dev_dbg(dev, "%lu %d %p\n",
 > 253				  map->size, order_base_2(map->size), map->handle);
   254			if (!map->handle) {
   255				kfree(map);
   256				return -ENOMEM;
   257			}
   258			map->offset = (unsigned long)map->handle;
   259			if (map->flags & _DRM_CONTAINS_LOCK) {
   260				/* Prevent a 2nd X Server from creating a 2nd lock */
   261				if (dev->master->lock.hw_lock != NULL) {
   262					vfree(map->handle);
   263					kfree(map);
   264					return -EBUSY;
   265				}
   266				dev->sigdata.lock = dev->master->lock.hw_lock = map->handle;	/* Pointer to lock */
   267			}
   268			break;
   269		case _DRM_AGP: {
   270			struct drm_agp_mem *entry;
   271			int valid = 0;
   272	
   273			if (!dev->agp) {
   274				kfree(map);
   275				return -EINVAL;
   276			}
   277	#ifdef __alpha__
   278			map->offset += dev->hose->mem_space->start;
   279	#endif
   280			/* In some cases (i810 driver), user space may have already
   281			 * added the AGP base itself, because dev->agp->base previously
   282			 * only got set during AGP enable.  So, only add the base
   283			 * address if the map's offset isn't already within the
   284			 * aperture.
   285			 */
   286			if (map->offset < dev->agp->base ||
   287			    map->offset > dev->agp->base +
   288			    dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
   289				map->offset += dev->agp->base;
   290			}
   291			map->mtrr = dev->agp->agp_mtrr;	/* for getmap */
   292	
   293			/* This assumes the DRM is in total control of AGP space.
   294			 * It's not always the case as AGP can be in the control
   295			 * of user space (i.e. i810 driver). So this loop will get
   296			 * skipped and we double check that dev->agp->memory is
   297			 * actually set as well as being invalid before EPERM'ing
   298			 */
   299			list_for_each_entry(entry, &dev->agp->memory, head) {
   300				if ((map->offset >= entry->bound) &&
   301				    (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
   302					valid = 1;
   303					break;
   304				}
   305			}
   306			if (!list_empty(&dev->agp->memory) && !valid) {
   307				kfree(map);
   308				return -EPERM;
   309			}
   310			drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
   311				  (unsigned long long)map->offset, map->size);
   312	
   313			break;
   314		}
   315		case _DRM_SCATTER_GATHER:
   316			if (!dev->sg) {
   317				kfree(map);
   318				return -EINVAL;
   319			}
   320			map->offset += (unsigned long)dev->sg->virtual;
   321			break;
   322		case _DRM_CONSISTENT:
   323			/* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
   324			 * As we're limiting the address to 2^32-1 (or less),
   325			 * casting it down to 32 bits is no problem, but we
   326			 * need to point to a 64bit variable first.
   327			 */
   328			map->handle = dma_alloc_coherent(dev->dev,
   329							 map->size,
   330							 &map->offset,
   331							 GFP_KERNEL);
   332			if (!map->handle) {
   333				kfree(map);
   334				return -ENOMEM;
   335			}
   336			break;
   337		default:
   338			kfree(map);
   339			return -EINVAL;
   340		}
   341	
   342		list = kzalloc(sizeof(*list), GFP_KERNEL);
   343		if (!list) {
   344			if (map->type == _DRM_REGISTERS)
   345				iounmap(map->handle);
   346			kfree(map);
   347			return -EINVAL;
   348		}
   349		list->map = map;
   350	
   351		mutex_lock(&dev->struct_mutex);
   352		list_add(&list->head, &dev->maplist);
   353	
   354		/* Assign a 32-bit handle */
   355		/* We do it here so that dev->struct_mutex protects the increment */
   356		user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
   357			map->offset;
   358		ret = drm_map_handle(dev, &list->hash, user_token, 0,
   359				     (map->type == _DRM_SHM));
   360		if (ret) {
   361			if (map->type == _DRM_REGISTERS)
   362				iounmap(map->handle);
   363			kfree(map);
   364			kfree(list);
   365			mutex_unlock(&dev->struct_mutex);
   366			return ret;
   367		}
   368	
   369		list->user_token = list->hash.key << PAGE_SHIFT;
   370		mutex_unlock(&dev->struct_mutex);
   371	
   372		if (!(map->flags & _DRM_DRIVER))
   373			list->master = dev->master;
   374		*maplist = list;
   375		return 0;
   376	}
   377	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
  2021-12-30 14:31   ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c kernel test robot
  (?)
@ 2021-12-30 20:05     ` Claudio Suarez
  -1 siblings, 0 replies; 10+ messages in thread
From: Claudio Suarez @ 2021-12-30 20:05 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, David Airlie, llvm, dri-devel, Thomas Zimmermann


Hi,

Please, don't apply this patch. I have to review it,.

BR



On Thu, Dec 30, 2021 at 10:31:45PM +0800, kernel test robot wrote:
> Hi Claudio,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on drm/drm-next]
> [also build test WARNING on drm-intel/for-linux-next drm-tip/drm-tip v5.16-rc7 next-20211224]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
> base:   git://anongit.freedesktop.org/drm/drm drm-next
> config: hexagon-randconfig-r041-20211230 (https://download.01.org/0day-ci/archive/20211230/202112302236.ikd2ET5w-lkp@intel.com/config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project cd284b7ac0615afc6e0f1a30da2777e361de27a3)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/0day-ci/linux/commit/9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
>         git checkout 9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/gpu/drm/drm_bufs.c:174:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
> >> drivers/gpu/drm/drm_bufs.c:174:19: warning: incompatible pointer to integer conversion passing 'char[46]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:175:7: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
>                        (unsigned long long)map->offset, map->size, map->type);
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:208:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                                    drm_dev_dbg(dev,
>                                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:209:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                                                "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:210:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
>                                                map->type, map->size, list->map->size);
>                                                ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:241:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                                    drm_dev_dbg(dev,
>                                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:242:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                                                "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:243:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
>                                                map->type, map->size, list->map->size);
>                                                ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:252:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                    drm_dev_dbg(dev, "%lu %d %p\n",
>                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:252:20: warning: incompatible pointer to integer conversion passing 'char[11]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                    drm_dev_dbg(dev, "%lu %d %p\n",
>                                     ^~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:253:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
>                              map->size, order_base_2(map->size), map->handle);
>                              ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:310:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                    drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:310:20: warning: incompatible pointer to integer conversion passing 'char[39]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                    drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:311:6: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
>                              (unsigned long long)map->offset, map->size);
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:914:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:914:19: warning: incompatible pointer to integer conversion passing 'char[34]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:915:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                        request->count, request->size, size, order);
>                        ^~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:977:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "pagelist: %d entries\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:977:19: warning: incompatible pointer to integer conversion passing 'char[22]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "pagelist: %d entries\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:978:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                        dma->page_count + (count << page_order));
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1017:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                            drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
>                                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1017:21: warning: incompatible pointer to integer conversion passing 'char[19]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                            drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
>                                             ^~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1018:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                                        dma->page_count + page_count,
>                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1053:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                            drm_dev_dbg(dev, "buffer %d @ %p\n",
>                                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1053:21: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                            drm_dev_dbg(dev, "buffer %d @ %p\n",
>                                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1054:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                                        entry->buf_count, buf->address);
>                                        ^~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1142:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1142:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1142:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                                                 ^~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1143:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1143:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1143:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                                                 ^~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1144:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "size:       %d\n", size);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
> 
> 
> vim +174 drivers/gpu/drm/drm_bufs.c
> 
>    138	
>    139	/*
>    140	 * Core function to create a range of memory available for mapping by a
>    141	 * non-root process.
>    142	 *
>    143	 * Adjusts the memory offset to its absolute value according to the mapping
>    144	 * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
>    145	 * applicable and if supported by the kernel.
>    146	 */
>    147	static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
>    148				   unsigned int size, enum drm_map_type type,
>    149				   enum drm_map_flags flags,
>    150				   struct drm_map_list **maplist)
>    151	{
>    152		struct drm_local_map *map;
>    153		struct drm_map_list *list;
>    154		unsigned long user_token;
>    155		int ret;
>    156	
>    157		map = kmalloc(sizeof(*map), GFP_KERNEL);
>    158		if (!map)
>    159			return -ENOMEM;
>    160	
>    161		map->offset = offset;
>    162		map->size = size;
>    163		map->flags = flags;
>    164		map->type = type;
>    165	
>    166		/* Only allow shared memory to be removable since we only keep enough
>    167		 * book keeping information about shared memory to allow for removal
>    168		 * when processes fork.
>    169		 */
>    170		if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
>    171			kfree(map);
>    172			return -EINVAL;
>    173		}
>  > 174		drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>  > 175			    (unsigned long long)map->offset, map->size, map->type);
>    176	
>    177		/* page-align _DRM_SHM maps. They are allocated here so there is no security
>    178		 * hole created by that and it works around various broken drivers that use
>    179		 * a non-aligned quantity to map the SAREA. --BenH
>    180		 */
>    181		if (map->type == _DRM_SHM)
>    182			map->size = PAGE_ALIGN(map->size);
>    183	
>    184		if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
>    185			kfree(map);
>    186			return -EINVAL;
>    187		}
>    188		map->mtrr = -1;
>    189		map->handle = NULL;
>    190	
>    191		switch (map->type) {
>    192		case _DRM_REGISTERS:
>    193		case _DRM_FRAME_BUFFER:
>    194	#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__arm__)
>    195			if (map->offset + (map->size-1) < map->offset ||
>    196			    map->offset < virt_to_phys(high_memory)) {
>    197				kfree(map);
>    198				return -EINVAL;
>    199			}
>    200	#endif
>    201			/* Some drivers preinitialize some maps, without the X Server
>    202			 * needing to be aware of it.  Therefore, we just return success
>    203			 * when the server tries to create a duplicate map.
>    204			 */
>    205			list = drm_find_matching_map(dev, map);
>    206			if (list != NULL) {
>    207				if (list->map->size != map->size) {
>    208					drm_dev_dbg(dev,
>    209						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>  > 210						    map->type, map->size, list->map->size);
>    211					list->map->size = map->size;
>    212				}
>    213	
>    214				kfree(map);
>    215				*maplist = list;
>    216				return 0;
>    217			}
>    218	
>    219			if (map->type == _DRM_FRAME_BUFFER ||
>    220			    (map->flags & _DRM_WRITE_COMBINING)) {
>    221				map->mtrr =
>    222					arch_phys_wc_add(map->offset, map->size);
>    223			}
>    224			if (map->type == _DRM_REGISTERS) {
>    225				if (map->flags & _DRM_WRITE_COMBINING)
>    226					map->handle = ioremap_wc(map->offset,
>    227								 map->size);
>    228				else
>    229					map->handle = ioremap(map->offset, map->size);
>    230				if (!map->handle) {
>    231					kfree(map);
>    232					return -ENOMEM;
>    233				}
>    234			}
>    235	
>    236			break;
>    237		case _DRM_SHM:
>    238			list = drm_find_matching_map(dev, map);
>    239			if (list != NULL) {
>    240				if (list->map->size != map->size) {
>    241					drm_dev_dbg(dev,
>    242						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>    243						    map->type, map->size, list->map->size);
>    244					list->map->size = map->size;
>    245				}
>    246	
>    247				kfree(map);
>    248				*maplist = list;
>    249				return 0;
>    250			}
>    251			map->handle = vmalloc_user(map->size);
>    252			drm_dev_dbg(dev, "%lu %d %p\n",
>  > 253				  map->size, order_base_2(map->size), map->handle);
>    254			if (!map->handle) {
>    255				kfree(map);
>    256				return -ENOMEM;
>    257			}
>    258			map->offset = (unsigned long)map->handle;
>    259			if (map->flags & _DRM_CONTAINS_LOCK) {
>    260				/* Prevent a 2nd X Server from creating a 2nd lock */
>    261				if (dev->master->lock.hw_lock != NULL) {
>    262					vfree(map->handle);
>    263					kfree(map);
>    264					return -EBUSY;
>    265				}
>    266				dev->sigdata.lock = dev->master->lock.hw_lock = map->handle;	/* Pointer to lock */
>    267			}
>    268			break;
>    269		case _DRM_AGP: {
>    270			struct drm_agp_mem *entry;
>    271			int valid = 0;
>    272	
>    273			if (!dev->agp) {
>    274				kfree(map);
>    275				return -EINVAL;
>    276			}
>    277	#ifdef __alpha__
>    278			map->offset += dev->hose->mem_space->start;
>    279	#endif
>    280			/* In some cases (i810 driver), user space may have already
>    281			 * added the AGP base itself, because dev->agp->base previously
>    282			 * only got set during AGP enable.  So, only add the base
>    283			 * address if the map's offset isn't already within the
>    284			 * aperture.
>    285			 */
>    286			if (map->offset < dev->agp->base ||
>    287			    map->offset > dev->agp->base +
>    288			    dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
>    289				map->offset += dev->agp->base;
>    290			}
>    291			map->mtrr = dev->agp->agp_mtrr;	/* for getmap */
>    292	
>    293			/* This assumes the DRM is in total control of AGP space.
>    294			 * It's not always the case as AGP can be in the control
>    295			 * of user space (i.e. i810 driver). So this loop will get
>    296			 * skipped and we double check that dev->agp->memory is
>    297			 * actually set as well as being invalid before EPERM'ing
>    298			 */
>    299			list_for_each_entry(entry, &dev->agp->memory, head) {
>    300				if ((map->offset >= entry->bound) &&
>    301				    (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
>    302					valid = 1;
>    303					break;
>    304				}
>    305			}
>    306			if (!list_empty(&dev->agp->memory) && !valid) {
>    307				kfree(map);
>    308				return -EPERM;
>    309			}
>    310			drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>    311				  (unsigned long long)map->offset, map->size);
>    312	
>    313			break;
>    314		}
>    315		case _DRM_SCATTER_GATHER:
>    316			if (!dev->sg) {
>    317				kfree(map);
>    318				return -EINVAL;
>    319			}
>    320			map->offset += (unsigned long)dev->sg->virtual;
>    321			break;
>    322		case _DRM_CONSISTENT:
>    323			/* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
>    324			 * As we're limiting the address to 2^32-1 (or less),
>    325			 * casting it down to 32 bits is no problem, but we
>    326			 * need to point to a 64bit variable first.
>    327			 */
>    328			map->handle = dma_alloc_coherent(dev->dev,
>    329							 map->size,
>    330							 &map->offset,
>    331							 GFP_KERNEL);
>    332			if (!map->handle) {
>    333				kfree(map);
>    334				return -ENOMEM;
>    335			}
>    336			break;
>    337		default:
>    338			kfree(map);
>    339			return -EINVAL;
>    340		}
>    341	
>    342		list = kzalloc(sizeof(*list), GFP_KERNEL);
>    343		if (!list) {
>    344			if (map->type == _DRM_REGISTERS)
>    345				iounmap(map->handle);
>    346			kfree(map);
>    347			return -EINVAL;
>    348		}
>    349		list->map = map;
>    350	
>    351		mutex_lock(&dev->struct_mutex);
>    352		list_add(&list->head, &dev->maplist);
>    353	
>    354		/* Assign a 32-bit handle */
>    355		/* We do it here so that dev->struct_mutex protects the increment */
>    356		user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
>    357			map->offset;
>    358		ret = drm_map_handle(dev, &list->hash, user_token, 0,
>    359				     (map->type == _DRM_SHM));
>    360		if (ret) {
>    361			if (map->type == _DRM_REGISTERS)
>    362				iounmap(map->handle);
>    363			kfree(map);
>    364			kfree(list);
>    365			mutex_unlock(&dev->struct_mutex);
>    366			return ret;
>    367		}
>    368	
>    369		list->user_token = list->hash.key << PAGE_SHIFT;
>    370		mutex_unlock(&dev->struct_mutex);
>    371	
>    372		if (!(map->flags & _DRM_DRIVER))
>    373			list->master = dev->master;
>    374		*maplist = list;
>    375		return 0;
>    376	}
>    377	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
@ 2021-12-30 20:05     ` Claudio Suarez
  0 siblings, 0 replies; 10+ messages in thread
From: Claudio Suarez @ 2021-12-30 20:05 UTC (permalink / raw)
  To: kernel test robot
  Cc: dri-devel, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, llvm, kbuild-all


Hi,

Please, don't apply this patch. I have to review it,.

BR



On Thu, Dec 30, 2021 at 10:31:45PM +0800, kernel test robot wrote:
> Hi Claudio,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on drm/drm-next]
> [also build test WARNING on drm-intel/for-linux-next drm-tip/drm-tip v5.16-rc7 next-20211224]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
> base:   git://anongit.freedesktop.org/drm/drm drm-next
> config: hexagon-randconfig-r041-20211230 (https://download.01.org/0day-ci/archive/20211230/202112302236.ikd2ET5w-lkp@intel.com/config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project cd284b7ac0615afc6e0f1a30da2777e361de27a3)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/0day-ci/linux/commit/9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
>         git checkout 9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/gpu/drm/drm_bufs.c:174:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
> >> drivers/gpu/drm/drm_bufs.c:174:19: warning: incompatible pointer to integer conversion passing 'char[46]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:175:7: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
>                        (unsigned long long)map->offset, map->size, map->type);
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:208:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                                    drm_dev_dbg(dev,
>                                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:209:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                                                "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:210:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
>                                                map->type, map->size, list->map->size);
>                                                ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:241:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                                    drm_dev_dbg(dev,
>                                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:242:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                                                "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:243:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
>                                                map->type, map->size, list->map->size);
>                                                ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:252:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                    drm_dev_dbg(dev, "%lu %d %p\n",
>                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:252:20: warning: incompatible pointer to integer conversion passing 'char[11]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                    drm_dev_dbg(dev, "%lu %d %p\n",
>                                     ^~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:253:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
>                              map->size, order_base_2(map->size), map->handle);
>                              ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:310:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                    drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:310:20: warning: incompatible pointer to integer conversion passing 'char[39]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                    drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:311:6: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
>                              (unsigned long long)map->offset, map->size);
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:914:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:914:19: warning: incompatible pointer to integer conversion passing 'char[34]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:915:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                        request->count, request->size, size, order);
>                        ^~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:977:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "pagelist: %d entries\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:977:19: warning: incompatible pointer to integer conversion passing 'char[22]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "pagelist: %d entries\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:978:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                        dma->page_count + (count << page_order));
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1017:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                            drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
>                                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1017:21: warning: incompatible pointer to integer conversion passing 'char[19]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                            drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
>                                             ^~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1018:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                                        dma->page_count + page_count,
>                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1053:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                            drm_dev_dbg(dev, "buffer %d @ %p\n",
>                                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1053:21: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                            drm_dev_dbg(dev, "buffer %d @ %p\n",
>                                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1054:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                                        entry->buf_count, buf->address);
>                                        ^~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1142:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1142:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1142:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                                                 ^~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1143:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1143:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1143:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                                                 ^~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1144:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "size:       %d\n", size);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
> 
> 
> vim +174 drivers/gpu/drm/drm_bufs.c
> 
>    138	
>    139	/*
>    140	 * Core function to create a range of memory available for mapping by a
>    141	 * non-root process.
>    142	 *
>    143	 * Adjusts the memory offset to its absolute value according to the mapping
>    144	 * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
>    145	 * applicable and if supported by the kernel.
>    146	 */
>    147	static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
>    148				   unsigned int size, enum drm_map_type type,
>    149				   enum drm_map_flags flags,
>    150				   struct drm_map_list **maplist)
>    151	{
>    152		struct drm_local_map *map;
>    153		struct drm_map_list *list;
>    154		unsigned long user_token;
>    155		int ret;
>    156	
>    157		map = kmalloc(sizeof(*map), GFP_KERNEL);
>    158		if (!map)
>    159			return -ENOMEM;
>    160	
>    161		map->offset = offset;
>    162		map->size = size;
>    163		map->flags = flags;
>    164		map->type = type;
>    165	
>    166		/* Only allow shared memory to be removable since we only keep enough
>    167		 * book keeping information about shared memory to allow for removal
>    168		 * when processes fork.
>    169		 */
>    170		if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
>    171			kfree(map);
>    172			return -EINVAL;
>    173		}
>  > 174		drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>  > 175			    (unsigned long long)map->offset, map->size, map->type);
>    176	
>    177		/* page-align _DRM_SHM maps. They are allocated here so there is no security
>    178		 * hole created by that and it works around various broken drivers that use
>    179		 * a non-aligned quantity to map the SAREA. --BenH
>    180		 */
>    181		if (map->type == _DRM_SHM)
>    182			map->size = PAGE_ALIGN(map->size);
>    183	
>    184		if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
>    185			kfree(map);
>    186			return -EINVAL;
>    187		}
>    188		map->mtrr = -1;
>    189		map->handle = NULL;
>    190	
>    191		switch (map->type) {
>    192		case _DRM_REGISTERS:
>    193		case _DRM_FRAME_BUFFER:
>    194	#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__arm__)
>    195			if (map->offset + (map->size-1) < map->offset ||
>    196			    map->offset < virt_to_phys(high_memory)) {
>    197				kfree(map);
>    198				return -EINVAL;
>    199			}
>    200	#endif
>    201			/* Some drivers preinitialize some maps, without the X Server
>    202			 * needing to be aware of it.  Therefore, we just return success
>    203			 * when the server tries to create a duplicate map.
>    204			 */
>    205			list = drm_find_matching_map(dev, map);
>    206			if (list != NULL) {
>    207				if (list->map->size != map->size) {
>    208					drm_dev_dbg(dev,
>    209						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>  > 210						    map->type, map->size, list->map->size);
>    211					list->map->size = map->size;
>    212				}
>    213	
>    214				kfree(map);
>    215				*maplist = list;
>    216				return 0;
>    217			}
>    218	
>    219			if (map->type == _DRM_FRAME_BUFFER ||
>    220			    (map->flags & _DRM_WRITE_COMBINING)) {
>    221				map->mtrr =
>    222					arch_phys_wc_add(map->offset, map->size);
>    223			}
>    224			if (map->type == _DRM_REGISTERS) {
>    225				if (map->flags & _DRM_WRITE_COMBINING)
>    226					map->handle = ioremap_wc(map->offset,
>    227								 map->size);
>    228				else
>    229					map->handle = ioremap(map->offset, map->size);
>    230				if (!map->handle) {
>    231					kfree(map);
>    232					return -ENOMEM;
>    233				}
>    234			}
>    235	
>    236			break;
>    237		case _DRM_SHM:
>    238			list = drm_find_matching_map(dev, map);
>    239			if (list != NULL) {
>    240				if (list->map->size != map->size) {
>    241					drm_dev_dbg(dev,
>    242						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>    243						    map->type, map->size, list->map->size);
>    244					list->map->size = map->size;
>    245				}
>    246	
>    247				kfree(map);
>    248				*maplist = list;
>    249				return 0;
>    250			}
>    251			map->handle = vmalloc_user(map->size);
>    252			drm_dev_dbg(dev, "%lu %d %p\n",
>  > 253				  map->size, order_base_2(map->size), map->handle);
>    254			if (!map->handle) {
>    255				kfree(map);
>    256				return -ENOMEM;
>    257			}
>    258			map->offset = (unsigned long)map->handle;
>    259			if (map->flags & _DRM_CONTAINS_LOCK) {
>    260				/* Prevent a 2nd X Server from creating a 2nd lock */
>    261				if (dev->master->lock.hw_lock != NULL) {
>    262					vfree(map->handle);
>    263					kfree(map);
>    264					return -EBUSY;
>    265				}
>    266				dev->sigdata.lock = dev->master->lock.hw_lock = map->handle;	/* Pointer to lock */
>    267			}
>    268			break;
>    269		case _DRM_AGP: {
>    270			struct drm_agp_mem *entry;
>    271			int valid = 0;
>    272	
>    273			if (!dev->agp) {
>    274				kfree(map);
>    275				return -EINVAL;
>    276			}
>    277	#ifdef __alpha__
>    278			map->offset += dev->hose->mem_space->start;
>    279	#endif
>    280			/* In some cases (i810 driver), user space may have already
>    281			 * added the AGP base itself, because dev->agp->base previously
>    282			 * only got set during AGP enable.  So, only add the base
>    283			 * address if the map's offset isn't already within the
>    284			 * aperture.
>    285			 */
>    286			if (map->offset < dev->agp->base ||
>    287			    map->offset > dev->agp->base +
>    288			    dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
>    289				map->offset += dev->agp->base;
>    290			}
>    291			map->mtrr = dev->agp->agp_mtrr;	/* for getmap */
>    292	
>    293			/* This assumes the DRM is in total control of AGP space.
>    294			 * It's not always the case as AGP can be in the control
>    295			 * of user space (i.e. i810 driver). So this loop will get
>    296			 * skipped and we double check that dev->agp->memory is
>    297			 * actually set as well as being invalid before EPERM'ing
>    298			 */
>    299			list_for_each_entry(entry, &dev->agp->memory, head) {
>    300				if ((map->offset >= entry->bound) &&
>    301				    (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
>    302					valid = 1;
>    303					break;
>    304				}
>    305			}
>    306			if (!list_empty(&dev->agp->memory) && !valid) {
>    307				kfree(map);
>    308				return -EPERM;
>    309			}
>    310			drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>    311				  (unsigned long long)map->offset, map->size);
>    312	
>    313			break;
>    314		}
>    315		case _DRM_SCATTER_GATHER:
>    316			if (!dev->sg) {
>    317				kfree(map);
>    318				return -EINVAL;
>    319			}
>    320			map->offset += (unsigned long)dev->sg->virtual;
>    321			break;
>    322		case _DRM_CONSISTENT:
>    323			/* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
>    324			 * As we're limiting the address to 2^32-1 (or less),
>    325			 * casting it down to 32 bits is no problem, but we
>    326			 * need to point to a 64bit variable first.
>    327			 */
>    328			map->handle = dma_alloc_coherent(dev->dev,
>    329							 map->size,
>    330							 &map->offset,
>    331							 GFP_KERNEL);
>    332			if (!map->handle) {
>    333				kfree(map);
>    334				return -ENOMEM;
>    335			}
>    336			break;
>    337		default:
>    338			kfree(map);
>    339			return -EINVAL;
>    340		}
>    341	
>    342		list = kzalloc(sizeof(*list), GFP_KERNEL);
>    343		if (!list) {
>    344			if (map->type == _DRM_REGISTERS)
>    345				iounmap(map->handle);
>    346			kfree(map);
>    347			return -EINVAL;
>    348		}
>    349		list->map = map;
>    350	
>    351		mutex_lock(&dev->struct_mutex);
>    352		list_add(&list->head, &dev->maplist);
>    353	
>    354		/* Assign a 32-bit handle */
>    355		/* We do it here so that dev->struct_mutex protects the increment */
>    356		user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
>    357			map->offset;
>    358		ret = drm_map_handle(dev, &list->hash, user_token, 0,
>    359				     (map->type == _DRM_SHM));
>    360		if (ret) {
>    361			if (map->type == _DRM_REGISTERS)
>    362				iounmap(map->handle);
>    363			kfree(map);
>    364			kfree(list);
>    365			mutex_unlock(&dev->struct_mutex);
>    366			return ret;
>    367		}
>    368	
>    369		list->user_token = list->hash.key << PAGE_SHIFT;
>    370		mutex_unlock(&dev->struct_mutex);
>    371	
>    372		if (!(map->flags & _DRM_DRIVER))
>    373			list->master = dev->master;
>    374		*maplist = list;
>    375		return 0;
>    376	}
>    377	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c
@ 2021-12-30 20:05     ` Claudio Suarez
  0 siblings, 0 replies; 10+ messages in thread
From: Claudio Suarez @ 2021-12-30 20:05 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 28760 bytes --]


Hi,

Please, don't apply this patch. I have to review it,.

BR



On Thu, Dec 30, 2021 at 10:31:45PM +0800, kernel test robot wrote:
> Hi Claudio,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on drm/drm-next]
> [also build test WARNING on drm-intel/for-linux-next drm-tip/drm-tip v5.16-rc7 next-20211224]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
> base:   git://anongit.freedesktop.org/drm/drm drm-next
> config: hexagon-randconfig-r041-20211230 (https://download.01.org/0day-ci/archive/20211230/202112302236.ikd2ET5w-lkp(a)intel.com/config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project cd284b7ac0615afc6e0f1a30da2777e361de27a3)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/0day-ci/linux/commit/9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Claudio-Suarez/drm-get-rid-of-DRM_DEBUG_-log-calls-in-drm-core-files-drm_-b-c-c/20211230-185446
>         git checkout 9cfa12f89e858cd6d2eb5eb17c6db7ab689343e3
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/gpu/drm/drm_bufs.c:174:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
> >> drivers/gpu/drm/drm_bufs.c:174:19: warning: incompatible pointer to integer conversion passing 'char[46]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:175:7: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
>                        (unsigned long long)map->offset, map->size, map->type);
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:208:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                                    drm_dev_dbg(dev,
>                                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:209:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                                                "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:210:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
>                                                map->type, map->size, list->map->size);
>                                                ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:241:17: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                                    drm_dev_dbg(dev,
>                                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:242:10: warning: incompatible pointer to integer conversion passing 'char[62]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                                                "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:243:10: warning: incompatible integer to pointer conversion passing 'enum drm_map_type' to parameter of type 'const char *' [-Wint-conversion]
>                                                map->type, map->size, list->map->size);
>                                                ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:252:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                    drm_dev_dbg(dev, "%lu %d %p\n",
>                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:252:20: warning: incompatible pointer to integer conversion passing 'char[11]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                    drm_dev_dbg(dev, "%lu %d %p\n",
>                                     ^~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:253:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
>                              map->size, order_base_2(map->size), map->handle);
>                              ^~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:310:15: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                    drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>                                ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:310:20: warning: incompatible pointer to integer conversion passing 'char[39]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                    drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:311:6: warning: incompatible integer to pointer conversion passing 'unsigned long long' to parameter of type 'const char *' [-Wint-conversion]
>                              (unsigned long long)map->offset, map->size);
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:914:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:914:19: warning: incompatible pointer to integer conversion passing 'char[34]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "count=%d, size=%d (%d), order=%d\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
> >> drivers/gpu/drm/drm_bufs.c:915:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                        request->count, request->size, size, order);
>                        ^~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:977:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "pagelist: %d entries\n",
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:977:19: warning: incompatible pointer to integer conversion passing 'char[22]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "pagelist: %d entries\n",
>                             ^~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:978:7: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                        dma->page_count + (count << page_order));
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1017:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                            drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
>                                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1017:21: warning: incompatible pointer to integer conversion passing 'char[19]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                            drm_dev_dbg(dev, "page %d @ 0x%08lx\n",
>                                             ^~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1018:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                                        dma->page_count + page_count,
>                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1053:16: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>                            drm_dev_dbg(dev, "buffer %d @ %p\n",
>                                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1053:21: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>                            drm_dev_dbg(dev, "buffer %d @ %p\n",
>                                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1054:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>                                        entry->buf_count, buf->address);
>                                        ^~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1142:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1142:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1142:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>            drm_dev_dbg(dev, "count:      %d\n", count);
>                                                 ^~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1143:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                          ^
>    drivers/gpu/drm/drm_bufs.c:1143:19: warning: incompatible pointer to integer conversion passing 'char[16]' to parameter of type 'enum drm_debug_category' [-Wint-conversion]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                             ^~~~~~~~~~~~~~~~~~
>    include/drm/drm_print.h:337:68: note: passing argument to parameter 'category' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>                                                                       ^
>    drivers/gpu/drm/drm_bufs.c:1143:39: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
>            drm_dev_dbg(dev, "order:      %d\n", order);
>                                                 ^~~~~
>    include/drm/drm_print.h:338:16: note: passing argument to parameter 'format' here
>                     const char *format, ...);
>                                 ^
>    drivers/gpu/drm/drm_bufs.c:1144:14: error: incompatible pointer types passing 'struct drm_device *' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
>            drm_dev_dbg(dev, "size:       %d\n", size);
>                        ^~~
>    include/drm/drm_print.h:337:39: note: passing argument to parameter 'dev' here
>    void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
> 
> 
> vim +174 drivers/gpu/drm/drm_bufs.c
> 
>    138	
>    139	/*
>    140	 * Core function to create a range of memory available for mapping by a
>    141	 * non-root process.
>    142	 *
>    143	 * Adjusts the memory offset to its absolute value according to the mapping
>    144	 * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
>    145	 * applicable and if supported by the kernel.
>    146	 */
>    147	static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
>    148				   unsigned int size, enum drm_map_type type,
>    149				   enum drm_map_flags flags,
>    150				   struct drm_map_list **maplist)
>    151	{
>    152		struct drm_local_map *map;
>    153		struct drm_map_list *list;
>    154		unsigned long user_token;
>    155		int ret;
>    156	
>    157		map = kmalloc(sizeof(*map), GFP_KERNEL);
>    158		if (!map)
>    159			return -ENOMEM;
>    160	
>    161		map->offset = offset;
>    162		map->size = size;
>    163		map->flags = flags;
>    164		map->type = type;
>    165	
>    166		/* Only allow shared memory to be removable since we only keep enough
>    167		 * book keeping information about shared memory to allow for removal
>    168		 * when processes fork.
>    169		 */
>    170		if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
>    171			kfree(map);
>    172			return -EINVAL;
>    173		}
>  > 174		drm_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
>  > 175			    (unsigned long long)map->offset, map->size, map->type);
>    176	
>    177		/* page-align _DRM_SHM maps. They are allocated here so there is no security
>    178		 * hole created by that and it works around various broken drivers that use
>    179		 * a non-aligned quantity to map the SAREA. --BenH
>    180		 */
>    181		if (map->type == _DRM_SHM)
>    182			map->size = PAGE_ALIGN(map->size);
>    183	
>    184		if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
>    185			kfree(map);
>    186			return -EINVAL;
>    187		}
>    188		map->mtrr = -1;
>    189		map->handle = NULL;
>    190	
>    191		switch (map->type) {
>    192		case _DRM_REGISTERS:
>    193		case _DRM_FRAME_BUFFER:
>    194	#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__arm__)
>    195			if (map->offset + (map->size-1) < map->offset ||
>    196			    map->offset < virt_to_phys(high_memory)) {
>    197				kfree(map);
>    198				return -EINVAL;
>    199			}
>    200	#endif
>    201			/* Some drivers preinitialize some maps, without the X Server
>    202			 * needing to be aware of it.  Therefore, we just return success
>    203			 * when the server tries to create a duplicate map.
>    204			 */
>    205			list = drm_find_matching_map(dev, map);
>    206			if (list != NULL) {
>    207				if (list->map->size != map->size) {
>    208					drm_dev_dbg(dev,
>    209						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>  > 210						    map->type, map->size, list->map->size);
>    211					list->map->size = map->size;
>    212				}
>    213	
>    214				kfree(map);
>    215				*maplist = list;
>    216				return 0;
>    217			}
>    218	
>    219			if (map->type == _DRM_FRAME_BUFFER ||
>    220			    (map->flags & _DRM_WRITE_COMBINING)) {
>    221				map->mtrr =
>    222					arch_phys_wc_add(map->offset, map->size);
>    223			}
>    224			if (map->type == _DRM_REGISTERS) {
>    225				if (map->flags & _DRM_WRITE_COMBINING)
>    226					map->handle = ioremap_wc(map->offset,
>    227								 map->size);
>    228				else
>    229					map->handle = ioremap(map->offset, map->size);
>    230				if (!map->handle) {
>    231					kfree(map);
>    232					return -ENOMEM;
>    233				}
>    234			}
>    235	
>    236			break;
>    237		case _DRM_SHM:
>    238			list = drm_find_matching_map(dev, map);
>    239			if (list != NULL) {
>    240				if (list->map->size != map->size) {
>    241					drm_dev_dbg(dev,
>    242						    "Matching maps of type %d with mismatched sizes, (%ld vs %ld)\n",
>    243						    map->type, map->size, list->map->size);
>    244					list->map->size = map->size;
>    245				}
>    246	
>    247				kfree(map);
>    248				*maplist = list;
>    249				return 0;
>    250			}
>    251			map->handle = vmalloc_user(map->size);
>    252			drm_dev_dbg(dev, "%lu %d %p\n",
>  > 253				  map->size, order_base_2(map->size), map->handle);
>    254			if (!map->handle) {
>    255				kfree(map);
>    256				return -ENOMEM;
>    257			}
>    258			map->offset = (unsigned long)map->handle;
>    259			if (map->flags & _DRM_CONTAINS_LOCK) {
>    260				/* Prevent a 2nd X Server from creating a 2nd lock */
>    261				if (dev->master->lock.hw_lock != NULL) {
>    262					vfree(map->handle);
>    263					kfree(map);
>    264					return -EBUSY;
>    265				}
>    266				dev->sigdata.lock = dev->master->lock.hw_lock = map->handle;	/* Pointer to lock */
>    267			}
>    268			break;
>    269		case _DRM_AGP: {
>    270			struct drm_agp_mem *entry;
>    271			int valid = 0;
>    272	
>    273			if (!dev->agp) {
>    274				kfree(map);
>    275				return -EINVAL;
>    276			}
>    277	#ifdef __alpha__
>    278			map->offset += dev->hose->mem_space->start;
>    279	#endif
>    280			/* In some cases (i810 driver), user space may have already
>    281			 * added the AGP base itself, because dev->agp->base previously
>    282			 * only got set during AGP enable.  So, only add the base
>    283			 * address if the map's offset isn't already within the
>    284			 * aperture.
>    285			 */
>    286			if (map->offset < dev->agp->base ||
>    287			    map->offset > dev->agp->base +
>    288			    dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
>    289				map->offset += dev->agp->base;
>    290			}
>    291			map->mtrr = dev->agp->agp_mtrr;	/* for getmap */
>    292	
>    293			/* This assumes the DRM is in total control of AGP space.
>    294			 * It's not always the case as AGP can be in the control
>    295			 * of user space (i.e. i810 driver). So this loop will get
>    296			 * skipped and we double check that dev->agp->memory is
>    297			 * actually set as well as being invalid before EPERM'ing
>    298			 */
>    299			list_for_each_entry(entry, &dev->agp->memory, head) {
>    300				if ((map->offset >= entry->bound) &&
>    301				    (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
>    302					valid = 1;
>    303					break;
>    304				}
>    305			}
>    306			if (!list_empty(&dev->agp->memory) && !valid) {
>    307				kfree(map);
>    308				return -EPERM;
>    309			}
>    310			drm_dev_dbg(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
>    311				  (unsigned long long)map->offset, map->size);
>    312	
>    313			break;
>    314		}
>    315		case _DRM_SCATTER_GATHER:
>    316			if (!dev->sg) {
>    317				kfree(map);
>    318				return -EINVAL;
>    319			}
>    320			map->offset += (unsigned long)dev->sg->virtual;
>    321			break;
>    322		case _DRM_CONSISTENT:
>    323			/* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
>    324			 * As we're limiting the address to 2^32-1 (or less),
>    325			 * casting it down to 32 bits is no problem, but we
>    326			 * need to point to a 64bit variable first.
>    327			 */
>    328			map->handle = dma_alloc_coherent(dev->dev,
>    329							 map->size,
>    330							 &map->offset,
>    331							 GFP_KERNEL);
>    332			if (!map->handle) {
>    333				kfree(map);
>    334				return -ENOMEM;
>    335			}
>    336			break;
>    337		default:
>    338			kfree(map);
>    339			return -EINVAL;
>    340		}
>    341	
>    342		list = kzalloc(sizeof(*list), GFP_KERNEL);
>    343		if (!list) {
>    344			if (map->type == _DRM_REGISTERS)
>    345				iounmap(map->handle);
>    346			kfree(map);
>    347			return -EINVAL;
>    348		}
>    349		list->map = map;
>    350	
>    351		mutex_lock(&dev->struct_mutex);
>    352		list_add(&list->head, &dev->maplist);
>    353	
>    354		/* Assign a 32-bit handle */
>    355		/* We do it here so that dev->struct_mutex protects the increment */
>    356		user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
>    357			map->offset;
>    358		ret = drm_map_handle(dev, &list->hash, user_token, 0,
>    359				     (map->type == _DRM_SHM));
>    360		if (ret) {
>    361			if (map->type == _DRM_REGISTERS)
>    362				iounmap(map->handle);
>    363			kfree(map);
>    364			kfree(list);
>    365			mutex_unlock(&dev->struct_mutex);
>    366			return ret;
>    367		}
>    368	
>    369		list->user_token = list->hash.key << PAGE_SHIFT;
>    370		mutex_unlock(&dev->struct_mutex);
>    371	
>    372		if (!(map->flags & _DRM_DRIVER))
>    373			list->master = dev->master;
>    374		*maplist = list;
>    375		return 0;
>    376	}
>    377	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
  2021-12-30 10:52 [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Claudio Suarez
  2021-12-30 14:31   ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c kernel test robot
@ 2021-12-31  9:07 ` Jani Nikula
  1 sibling, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2021-12-31  9:07 UTC (permalink / raw)
  To: Claudio Suarez, dri-devel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter

On Thu, 30 Dec 2021, Claudio Suarez <cssk@net-c.es> wrote:
> DRM_DEBUG_* and DRM_* log calls are deprecated.
> Change them to drm_dbg_* / drm_{err,info,...} calls in drm core
> files.
>
> To avoid making a very big patch, this change is split in
> smaller patches. This one includes drm_{b,c}*.c

Personally, I'd split it further to smaller patches.

>
> Signed-off-by: Claudio Suarez <cssk@net-c.es>
> ---
>  drivers/gpu/drm/drm_blend.c          |   6 +-
>  drivers/gpu/drm/drm_bridge.c         |   6 +-
>  drivers/gpu/drm/drm_bufs.c           | 116 +++++++++++++--------------
>  drivers/gpu/drm/drm_client_modeset.c | 109 +++++++++++++------------
>  drivers/gpu/drm/drm_color_mgmt.c     |   6 +-
>  drivers/gpu/drm/drm_connector.c      |  37 +++++----
>  drivers/gpu/drm/drm_context.c        |  18 ++---
>  drivers/gpu/drm/drm_crtc.c           |  40 ++++-----
>  drivers/gpu/drm/drm_crtc_helper.c    |  61 +++++++-------
>  9 files changed, 211 insertions(+), 188 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> index ec37cbfabb50..4a988815f998 100644
> --- a/drivers/gpu/drm/drm_blend.c
> +++ b/drivers/gpu/drm/drm_blend.c
> @@ -450,7 +450,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
>  	int i, n = 0;
>  	int ret = 0;
>  
> -	DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n",
> +	drm_dbg_atomic(dev, "[CRTC:%d:%s] calculating normalized zpos values\n",
>  			 crtc->base.id, crtc->name);

Throughout the patch, please fix the indentation on the following
lines. The lines should be aligned at the next column after the opening
brace "(" in the function call, like they used to be.

>  
>  	states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL);
> @@ -469,7 +469,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
>  			goto done;
>  		}
>  		states[n++] = plane_state;
> -		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] processing zpos value %d\n",
> +		drm_dbg_atomic(dev, "[PLANE:%d:%s] processing zpos value %d\n",
>  				 plane->base.id, plane->name,
>  				 plane_state->zpos);
>  	}
> @@ -480,7 +480,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
>  		plane = states[i]->plane;
>  
>  		states[i]->normalized_zpos = i;
> -		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] normalized zpos value %d\n",
> +		drm_dbg_atomic(dev, "[PLANE:%d:%s] normalized zpos value %d\n",
>  				 plane->base.id, plane->name, i);
>  	}
>  	crtc_state->zpos_changed = true;
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index c96847fc0ebc..b108377b4b40 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -288,10 +288,12 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
>  	list_del(&bridge->chain_node);
>  
>  #ifdef CONFIG_OF
> -	DRM_ERROR("failed to attach bridge %pOF to encoder %s: %d\n",
> +	drm_err(encoder->dev,
> +		  "failed to attach bridge %pOF to encoder %s: %d\n",
>  		  bridge->of_node, encoder->name, ret);
>  #else
> -	DRM_ERROR("failed to attach bridge to encoder %s: %d\n",
> +	drm_err(encoder->dev,
> +		  "failed to attach bridge to encoder %s: %d\n",
>  		  encoder->name, ret);
>  #endif
>  
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index fcca21e8efac..dd8e100e120c 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_dev_dbg(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
> +		    (unsigned long long)map->offset, map->size, map->type);

Please avoid drm_dev_dbg() when struct drm_device is available,
throughout the patch. DRM_DEBUG() -> drm_dbg_core() in drm_*.[ch].

Clearly dev is struct drm_device here, and in a lot of places, so you're
passing an incompatible pointer to drm_dev_dbg(), which is for when you
only have struct device available.


BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
  2021-12-30 20:05     ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Claudio Suarez
  (?)
@ 2021-12-31  9:10       ` Jani Nikula
  -1 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2021-12-31  9:10 UTC (permalink / raw)
  To: Claudio Suarez, kernel test robot
  Cc: kbuild-all, David Airlie, llvm, dri-devel, Thomas Zimmermann

On Thu, 30 Dec 2021, Claudio Suarez <cssk@net-c.es> wrote:
> Please, don't apply this patch. I have to review it,.

Please make sure you build with DRM_LEGACY=y to include drm_bufs.c in
the build.

If you Cc: intel-gfx@lists.freedesktop.org on the patch, you'll get
Intel CI results on the patch too.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c
@ 2021-12-31  9:10       ` Jani Nikula
  0 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2021-12-31  9:10 UTC (permalink / raw)
  To: Claudio Suarez, kernel test robot
  Cc: David Airlie, llvm, kbuild-all, Thomas Zimmermann, dri-devel

On Thu, 30 Dec 2021, Claudio Suarez <cssk@net-c.es> wrote:
> Please, don't apply this patch. I have to review it,.

Please make sure you build with DRM_LEGACY=y to include drm_bufs.c in
the build.

If you Cc: intel-gfx@lists.freedesktop.org on the patch, you'll get
Intel CI results on the patch too.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c
@ 2021-12-31  9:10       ` Jani Nikula
  0 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2021-12-31  9:10 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

On Thu, 30 Dec 2021, Claudio Suarez <cssk@net-c.es> wrote:
> Please, don't apply this patch. I have to review it,.

Please make sure you build with DRM_LEGACY=y to include drm_bufs.c in
the build.

If you Cc: intel-gfx(a)lists.freedesktop.org on the patch, you'll get
Intel CI results on the patch too.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-31  9:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 10:52 [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Claudio Suarez
2021-12-30 14:31 ` kernel test robot
2021-12-30 14:31   ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c kernel test robot
2021-12-30 20:05   ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Claudio Suarez
2021-12-30 20:05     ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c Claudio Suarez
2021-12-30 20:05     ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Claudio Suarez
2021-12-31  9:10     ` Jani Nikula
2021-12-31  9:10       ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b, c}*.c Jani Nikula
2021-12-31  9:10       ` [PATCH] drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c Jani Nikula
2021-12-31  9:07 ` Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.