Skip to contentSkip to conversation

drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c

PATCH In review Claudio Suarez 3 participants 5 messages Dec 30, 2021 – Dec 31, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_{b,c}*.c

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

---
 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(-)
drivers/gpu/drm/drm_blend.c +3 -3
index ec37cbfabb50..4a988815f998 100644
@@ -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;
drivers/gpu/drm/drm_bridge.c +4 -2
index c96847fc0ebc..b108377b4b40 100644
@@ -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
 
drivers/gpu/drm/drm_bufs.c +58 -58

263 lines not on this page · raw message

drivers/gpu/drm/drm_client_modeset.c +58 -51

265 lines not on this page · raw message

drivers/gpu/drm/drm_color_mgmt.c +4 -2
index bb14f488c8f6..b2bdb684a1e3 100644
@@ -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;
 			}
 		}
drivers/gpu/drm/drm_connector.c +21 -16
index 52e20c68813b..c9ac42277f3c 100644
@@ -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);
 			}
 		}
 	}
drivers/gpu/drm/drm_context.c +9 -9
index c6e6a3e7219a..c52764e98d26 100644
@@ -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);
drivers/gpu/drm/drm_crtc.c +21 -19
index 26a77a735905..994147abf9eb 100644
@@ -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;
 		}
drivers/gpu/drm/drm_crtc_helper.c +33 -28

166 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Thank you for the patch! Perhaps something to improve:

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

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

#2 lore raw

Hi,

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

BR

Quoted 481 lines · kernel test robot

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

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,
                                         ^
Quoted 1 line
Quoted 1 line

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,
                                                                      ^
Quoted 1 line
Quoted 1 line

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,
                                                                      ^
Quoted 1 line
Quoted 1 line

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,
                                                                      ^
Quoted 1 line
Quoted 1 line

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,
                                                                      ^
Quoted 1 line
Quoted 1 line

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		}
Quoted 2 lines

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",
Quoted 1 line

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",
Quoted 1 line

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

#3 lore raw
Quoted 1 line · Claudio Suarez

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.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#4 lore raw
In reply to Claudio Suarez
Quoted 6 lines · Claudio Suarez

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.

Quoted 19 lines
---
 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(-)
drivers/gpu/drm/drm_blend.c +0 -0
index ec37cbfabb50..4a988815f998 100644

drivers/gpu/drm/drm_blend.c static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc, · line 454

Quoted 6 lines
drivers/gpu/drm/drm_blend.c +1 -1
@@ -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.

Quoted 44 lines
drivers/gpu/drm/drm_blend.c +2 -2
 	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;
drivers/gpu/drm/drm_bridge.c +4 -2
index c96847fc0ebc..b108377b4b40 100644
@@ -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
 
drivers/gpu/drm/drm_bufs.c +0 -0
index fcca21e8efac..dd8e100e120c 100644

drivers/gpu/drm/drm_bufs.c static int drm_addmap_core(struct drm_device *dev, resource_size_t offset, · line 175

Quoted 7 lines
drivers/gpu/drm/drm_bufs.c +2 -2
@@ -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.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center