[v4,04/10] drm: Remove usage of deprecated DRM_ERROR

Message ID 41614db7ed24952d62668b95a75fe97cbaa95e1a.1672957022.git.code@siddh.me
State New
Headers
Series drm: Remove usage of deprecated DRM_* macros |

Commit Message

Siddh Raman Pant Jan. 5, 2023, 10:24 p.m. UTC
  drm_print.h says DRM_ERROR is deprecated in favor of drm_err().

Signed-off-by: Siddh Raman Pant <code@siddh.me>
---
 drivers/gpu/drm/drm_bridge.c         |  8 ++++----
 drivers/gpu/drm/drm_bufs.c           |  8 ++++----
 drivers/gpu/drm/drm_client_modeset.c |  4 ++--
 drivers/gpu/drm/drm_context.c        |  4 ++--
 drivers/gpu/drm/drm_crtc_helper.c    |  8 ++++----
 drivers/gpu/drm/drm_debugfs_crc.c    |  3 ++-
 drivers/gpu/drm/drm_drv.c            | 14 +++++++-------
 drivers/gpu/drm/drm_flip_work.c      |  2 +-
 drivers/gpu/drm/drm_framebuffer.c    |  3 ++-
 drivers/gpu/drm/drm_gem.c            |  2 +-
 drivers/gpu/drm/drm_gem_dma_helper.c |  2 +-
 drivers/gpu/drm/drm_hashtab.c        |  4 ++--
 drivers/gpu/drm/drm_lock.c           | 16 ++++++++--------
 drivers/gpu/drm/drm_mipi_dbi.c       |  2 +-
 drivers/gpu/drm/drm_mipi_dsi.c       | 12 ++++++------
 drivers/gpu/drm/drm_mm.c             |  8 ++++----
 drivers/gpu/drm/drm_mode_config.c    |  2 +-
 drivers/gpu/drm/drm_modes.c          | 26 +++++++++++++-------------
 drivers/gpu/drm/drm_modeset_helper.c |  2 +-
 drivers/gpu/drm/drm_plane.c          |  2 +-
 drivers/gpu/drm/drm_scatter.c        |  9 +++++----
 drivers/gpu/drm/drm_vm.c             |  2 +-
 22 files changed, 73 insertions(+), 70 deletions(-)
  

Patch

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index c3d69af02e79..3d27f08db74d 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -351,11 +351,11 @@  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",
-		  bridge->of_node, encoder->name, ret);
+	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",
-		  encoder->name, ret);
+	drm_err(encoder->dev, "failed to attach bridge to encoder %s: %d\n",
+		encoder->name, ret);
 #endif
 
 	return ret;
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index fcca21e8efac..98aaf3379a3b 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1474,15 +1474,15 @@  int drm_legacy_freebufs(struct drm_device *dev, void *data,
 		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);
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ae19734974b5..e2403b8c6347 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -808,7 +808,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(client->dev, "Memory allocation failed\n");
 		ret = -ENOMEM;
 		goto out;
 	}
@@ -832,7 +832,7 @@  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(client->dev, "Unable to find initial modes\n");
 
 		DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
 			      width, height);
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index c6e6a3e7219a..f6d68fad8311 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -276,7 +276,7 @@  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;
 	}
 
@@ -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
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index a209659a996c..b74b4301a471 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -768,8 +768,8 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set,
 			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",
-					  set->crtc->base.id, set->crtc->name);
+				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;
@@ -826,7 +826,7 @@  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);
@@ -996,7 +996,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)) {
diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index bbc3bc4ba844..a59ef3f0e4a1 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -416,7 +416,8 @@  int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
 		spin_unlock_irqrestore(&crc->lock, flags);
 
 		if (!was_overflow)
-			DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n");
+			drm_err(crtc->dev,
+				"Overflow of CRC buffer, userspace reads too slow.\n");
 
 		return -ENOBUFS;
 	}
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index dfb73c9d7930..5802d714ad8d 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -163,7 +163,7 @@  static int drm_minor_register(struct drm_device *dev, unsigned int type)
 
 	ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
 	if (ret) {
-		DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
+		drm_err(dev, "DRM: Failed to initialize /sys/kernel/debug/dri.\n");
 		goto err_debugfs;
 	}
 
@@ -402,7 +402,7 @@  void drm_put_dev(struct drm_device *dev)
 	DRM_DEBUG("\n");
 
 	if (!dev) {
-		DRM_ERROR("cleanup called no dev\n");
+		drm_err(NULL, "cleanup called no dev\n");
 		return;
 	}
 
@@ -517,7 +517,7 @@  static struct inode *drm_fs_inode_new(void)
 
 	r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
 	if (r < 0) {
-		DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
+		drm_err(NULL, "Cannot mount pseudo fs: %d\n", r);
 		return ERR_PTR(r);
 	}
 
@@ -587,7 +587,7 @@  static int drm_dev_init(struct drm_device *dev,
 	int ret;
 
 	if (!drm_core_init_complete) {
-		DRM_ERROR("DRM core is not initialized\n");
+		drm_err(NULL, "DRM core is not initialized\n");
 		return -ENODEV;
 	}
 
@@ -625,7 +625,7 @@  static int drm_dev_init(struct drm_device *dev,
 	inode = drm_fs_inode_new();
 	if (IS_ERR(inode)) {
 		ret = PTR_ERR(inode);
-		DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret);
+		drm_err(dev, "Cannot allocate anonymous inode: %d\n", ret);
 		goto err;
 	}
 
@@ -650,7 +650,7 @@  static int drm_dev_init(struct drm_device *dev,
 	if (drm_core_check_feature(dev, DRIVER_GEM)) {
 		ret = drm_gem_init(dev);
 		if (ret) {
-			DRM_ERROR("Cannot initialize graphics execution manager (GEM)\n");
+			drm_err(dev, "Cannot initialize graphics execution manager (GEM)\n");
 			goto err;
 		}
 	}
@@ -1054,7 +1054,7 @@  static int __init drm_core_init(void)
 
 	ret = drm_sysfs_init();
 	if (ret < 0) {
-		DRM_ERROR("Cannot create DRM class: %d\n", ret);
+		drm_err(NULL, "Cannot create DRM class: %d\n", ret);
 		goto error;
 	}
 
diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c
index 060b753881a2..8cbf325a0414 100644
--- a/drivers/gpu/drm/drm_flip_work.c
+++ b/drivers/gpu/drm/drm_flip_work.c
@@ -82,7 +82,7 @@  void drm_flip_work_queue(struct drm_flip_work *work, void *val)
 	if (task) {
 		drm_flip_work_queue_task(work, task);
 	} else {
-		DRM_ERROR("%s could not allocate task!\n", work->name);
+		drm_err(NULL, "%s could not allocate task!\n", work->name);
 		work->func(work, val);
 	}
 }
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index aff3746dedfb..b21071919644 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -1070,7 +1070,8 @@  static void legacy_remove_fb(struct drm_framebuffer *fb)
 
 			/* should turn off the crtc */
 			if (drm_crtc_force_disable(crtc))
-				DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc);
+				drm_err(dev, "failed to reset crtc %p when fb was deleted\n",
+					crtc);
 		}
 	}
 
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 59a0bb5ebd85..c14bff925a12 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -101,7 +101,7 @@  drm_gem_init(struct drm_device *dev)
 	vma_offset_manager = drmm_kzalloc(dev, sizeof(*vma_offset_manager),
 					  GFP_KERNEL);
 	if (!vma_offset_manager) {
-		DRM_ERROR("out of memory\n");
+		drm_err(dev, "out of memory\n");
 		return -ENOMEM;
 	}
 
diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c
index 1e658c448366..1ba551b0ab97 100644
--- a/drivers/gpu/drm/drm_gem_dma_helper.c
+++ b/drivers/gpu/drm/drm_gem_dma_helper.c
@@ -583,7 +583,7 @@  drm_gem_dma_prime_import_sg_table_vmap(struct drm_device *dev,
 
 	ret = dma_buf_vmap_unlocked(attach->dmabuf, &map);
 	if (ret) {
-		DRM_ERROR("Failed to vmap PRIME buffer\n");
+		drm_err(dev, "Failed to vmap PRIME buffer\n");
 		return ERR_PTR(ret);
 	}
 
diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index 60afa1865559..a1ebf8e056c7 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -53,7 +53,7 @@  int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
 	else
 		ht->table = vzalloc(array_size(size, sizeof(*ht->table)));
 	if (!ht->table) {
-		DRM_ERROR("Out of memory for hash table\n");
+		drm_err(NULL, "Out of memory for hash table\n");
 		return -ENOMEM;
 	}
 	return 0;
@@ -157,7 +157,7 @@  int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *it
 	} while(ret && (unshifted_key != first));
 
 	if (ret) {
-		DRM_ERROR("Available key bit space exhausted\n");
+		drm_err(NULL, "Available key bit space exhausted\n");
 		return -EINVAL;
 	}
 	return 0;
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 1efbd5389d89..411f75a1ee14 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -79,8 +79,8 @@  int drm_lock_take(struct drm_lock_data *lock_data,
 	if (_DRM_LOCKING_CONTEXT(old) == context) {
 		if (old & _DRM_LOCK_HELD) {
 			if (context != DRM_KERNEL_CONTEXT) {
-				DRM_ERROR("%d holds heavyweight lock\n",
-					  context);
+				drm_err(NULL, "%d holds heavyweight lock\n",
+					context);
 			}
 			return 0;
 		}
@@ -142,8 +142,8 @@  static int drm_legacy_lock_free(struct drm_lock_data *lock_data,
 	} while (prev != old);
 
 	if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
-		DRM_ERROR("%d freed heavyweight lock held by %d\n",
-			  context, _DRM_LOCKING_CONTEXT(old));
+		drm_err(NULL, "%d freed heavyweight lock held by %d\n",
+			context, _DRM_LOCKING_CONTEXT(old));
 		return 1;
 	}
 	wake_up_interruptible(&lock_data->lock_queue);
@@ -175,8 +175,8 @@  int drm_legacy_lock(struct drm_device *dev, void *data,
 	++file_priv->lock_count;
 
 	if (lock->context == DRM_KERNEL_CONTEXT) {
-		DRM_ERROR("Process %d using kernel context %d\n",
-			  task_pid_nr(current), lock->context);
+		drm_err(dev, "Process %d using kernel context %d\n",
+			task_pid_nr(current), lock->context);
 		return -EINVAL;
 	}
 
@@ -263,8 +263,8 @@  int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_
 		return -EOPNOTSUPP;
 
 	if (lock->context == DRM_KERNEL_CONTEXT) {
-		DRM_ERROR("Process %d using kernel context %d\n",
-			  task_pid_nr(current), lock->context);
+		drm_err(dev, "Process %d using kernel context %d\n",
+			task_pid_nr(current), lock->context);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index c871d9f096b8..58ff9503a403 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -603,7 +603,7 @@  int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
 	drm_mode_copy(&dbidev->mode, mode);
 	ret = mipi_dbi_rotate_mode(&dbidev->mode, rotation);
 	if (ret) {
-		DRM_ERROR("Illegal rotation value %u\n", rotation);
+		drm_err(drm, "Illegal rotation value %u\n", rotation);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 497ef4b6a90a..d9d70601ccb4 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -161,13 +161,13 @@  of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
 	u32 reg;
 
 	if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
-		drm_err(host, "modalias failure on %pOF\n", node);
+		drm_err(host->dev, "modalias failure on %pOF\n", node);
 		return ERR_PTR(-EINVAL);
 	}
 
 	ret = of_property_read_u32(node, "reg", &reg);
 	if (ret) {
-		drm_err(host, "device node %pOF has no valid reg property: %d\n",
+		drm_err(host->dev, "device node %pOF has no valid reg property: %d\n",
 			node, ret);
 		return ERR_PTR(-EINVAL);
 	}
@@ -205,18 +205,18 @@  mipi_dsi_device_register_full(struct mipi_dsi_host *host,
 	int ret;
 
 	if (!info) {
-		drm_err(host, "invalid mipi_dsi_device_info pointer\n");
+		drm_err(host->dev, "invalid mipi_dsi_device_info pointer\n");
 		return ERR_PTR(-EINVAL);
 	}
 
 	if (info->channel > 3) {
-		drm_err(host, "invalid virtual channel: %u\n", info->channel);
+		drm_err(host->dev, "invalid virtual channel: %u\n", info->channel);
 		return ERR_PTR(-EINVAL);
 	}
 
 	dsi = mipi_dsi_device_alloc(host);
 	if (IS_ERR(dsi)) {
-		drm_err(host, "failed to allocate DSI device %ld\n",
+		drm_err(host->dev, "failed to allocate DSI device %ld\n",
 			PTR_ERR(dsi));
 		return dsi;
 	}
@@ -227,7 +227,7 @@  mipi_dsi_device_register_full(struct mipi_dsi_host *host,
 
 	ret = mipi_dsi_device_add(dsi);
 	if (ret) {
-		drm_err(host, "failed to add DSI device %d\n", ret);
+		drm_err(host->dev, "failed to add DSI device %d\n", ret);
 		kfree(dsi);
 		return ERR_PTR(ret);
 	}
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 8257f9d4f619..0a8d62c8f359 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -126,14 +126,14 @@  static void show_leaks(struct drm_mm *mm)
 
 	list_for_each_entry(node, drm_mm_nodes(mm), node_list) {
 		if (!node->stack) {
-			DRM_ERROR("node [%08llx + %08llx]: unknown owner\n",
-				  node->start, node->size);
+			drm_err(NULL, "node [%08llx + %08llx]: unknown owner\n",
+				node->start, node->size);
 			continue;
 		}
 
 		stack_depot_snprint(node->stack, buf, BUFSZ, 0);
-		DRM_ERROR("node [%08llx + %08llx]: inserted at\n%s",
-			  node->start, node->size, buf);
+		drm_err(NULL, "node [%08llx + %08llx]: inserted at\n%s",
+			node->start, node->size, buf);
 	}
 
 	kfree(buf);
diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index 87eb591fe9b5..b86473ab9ff7 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -513,7 +513,7 @@  void drm_mode_config_cleanup(struct drm_device *dev)
 	if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
 		drm_connector_list_iter_begin(dev, &conn_iter);
 		drm_for_each_connector_iter(connector, &conn_iter)
-			DRM_ERROR("connector %s leaked!\n", connector->name);
+			drm_err(dev, "connector %s leaked!\n", connector->name);
 		drm_connector_list_iter_end(&conn_iter);
 	}
 
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index be030f4a5311..cc6d1f216e78 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -372,8 +372,8 @@  static int fill_analog_mode(struct drm_device *dev,
 	if (!bt601 &&
 	    (hact_duration_ns < params->hact_ns.min ||
 	     hact_duration_ns > params->hact_ns.max)) {
-		DRM_ERROR("Invalid horizontal active area duration: %uns (min: %u, max %u)\n",
-			  hact_duration_ns, params->hact_ns.min, params->hact_ns.max);
+		drm_err(dev, "Invalid horizontal active area duration: %uns (min: %u, max %u)\n",
+			hact_duration_ns, params->hact_ns.min, params->hact_ns.max);
 		return -EINVAL;
 	}
 
@@ -384,8 +384,8 @@  static int fill_analog_mode(struct drm_device *dev,
 	if (!bt601 &&
 	    (hblk_duration_ns < params->hblk_ns.min ||
 	     hblk_duration_ns > params->hblk_ns.max)) {
-		DRM_ERROR("Invalid horizontal blanking duration: %uns (min: %u, max %u)\n",
-			  hblk_duration_ns, params->hblk_ns.min, params->hblk_ns.max);
+		drm_err(dev, "Invalid horizontal blanking duration: %uns (min: %u, max %u)\n",
+			hblk_duration_ns, params->hblk_ns.min, params->hblk_ns.max);
 		return -EINVAL;
 	}
 
@@ -396,8 +396,8 @@  static int fill_analog_mode(struct drm_device *dev,
 	if (!bt601 &&
 	    (hslen_duration_ns < params->hslen_ns.min ||
 	     hslen_duration_ns > params->hslen_ns.max)) {
-		DRM_ERROR("Invalid horizontal sync duration: %uns (min: %u, max %u)\n",
-			  hslen_duration_ns, params->hslen_ns.min, params->hslen_ns.max);
+		drm_err(dev, "Invalid horizontal sync duration: %uns (min: %u, max %u)\n",
+			hslen_duration_ns, params->hslen_ns.min, params->hslen_ns.max);
 		return -EINVAL;
 	}
 
@@ -408,7 +408,7 @@  static int fill_analog_mode(struct drm_device *dev,
 	if (!bt601 &&
 	    (porches_duration_ns > (params->hfp_ns.max + params->hbp_ns.max) ||
 	     porches_duration_ns < (params->hfp_ns.min + params->hbp_ns.min))) {
-		DRM_ERROR("Invalid horizontal porches duration: %uns\n", porches_duration_ns);
+		drm_err(dev, "Invalid horizontal porches duration: %uns\n", porches_duration_ns);
 		return -EINVAL;
 	}
 
@@ -430,8 +430,8 @@  static int fill_analog_mode(struct drm_device *dev,
 	if (!bt601 &&
 	    (hfp_duration_ns < params->hfp_ns.min ||
 	     hfp_duration_ns > params->hfp_ns.max)) {
-		DRM_ERROR("Invalid horizontal front porch duration: %uns (min: %u, max %u)\n",
-			  hfp_duration_ns, params->hfp_ns.min, params->hfp_ns.max);
+		drm_err(dev, "Invalid horizontal front porch duration: %uns (min: %u, max %u)\n",
+			hfp_duration_ns, params->hfp_ns.min, params->hfp_ns.max);
 		return -EINVAL;
 	}
 
@@ -442,8 +442,8 @@  static int fill_analog_mode(struct drm_device *dev,
 	if (!bt601 &&
 	    (hbp_duration_ns < params->hbp_ns.min ||
 	     hbp_duration_ns > params->hbp_ns.max)) {
-		DRM_ERROR("Invalid horizontal back porch duration: %uns (min: %u, max %u)\n",
-			  hbp_duration_ns, params->hbp_ns.min, params->hbp_ns.max);
+		drm_err(dev, "Invalid horizontal back porch duration: %uns (min: %u, max %u)\n",
+			hbp_duration_ns, params->hbp_ns.min, params->hbp_ns.max);
 		return -EINVAL;
 	}
 
@@ -494,8 +494,8 @@  static int fill_analog_mode(struct drm_device *dev,
 
 	vtotal = vactive + vfp + vslen + vbp;
 	if (params->num_lines != vtotal) {
-		DRM_ERROR("Invalid vertical total: %upx (expected %upx)\n",
-			  vtotal, params->num_lines);
+		drm_err(dev, "Invalid vertical total: %upx (expected %upx)\n",
+			vtotal, params->num_lines);
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index f858dfedf2cf..e26b0285dde6 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -235,7 +235,7 @@  int drm_mode_config_helper_resume(struct drm_device *dev)
 
 	ret = drm_atomic_helper_resume(dev, dev->mode_config.suspend_state);
 	if (ret)
-		DRM_ERROR("Failed to resume (%d)\n", ret);
+		drm_err(dev, "Failed to resume (%d)\n", ret);
 	dev->mode_config.suspend_state = NULL;
 
 	drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 24e7998d1731..fc11efd5e560 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -611,7 +611,7 @@  void drm_plane_force_disable(struct drm_plane *plane)
 	plane->old_fb = plane->fb;
 	ret = plane->funcs->disable_plane(plane, NULL);
 	if (ret) {
-		DRM_ERROR("failed to disable plane with busy fb\n");
+		drm_err(plane->dev, "failed to disable plane with busy fb\n");
 		plane->old_fb = NULL;
 		return;
 	}
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index f4e6184d1877..5b0b2140d535 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -170,9 +170,10 @@  int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
 			     j++, tmp++) {
 				if (*tmp != 0xcafebabe && error == 0) {
 					error = 1;
-					DRM_ERROR("Scatter allocation error, "
-						  "pagelist does not match "
-						  "virtual mapping\n");
+					drm_err(dev,
+						"Scatter allocation error, "
+						"pagelist does not match "
+						"virtual mapping\n");
 				}
 			}
 			tmp = page_address(entry->pagelist[i]);
@@ -183,7 +184,7 @@  int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
 			}
 		}
 		if (error == 0)
-			DRM_ERROR("Scatter allocation matches pagelist\n");
+			drm_err(dev, "Scatter allocation matches pagelist\n");
 	}
 #endif
 
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index f024dc93939e..cdb956af2079 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -547,7 +547,7 @@  static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 		return drm_mmap_dma(filp, vma);
 
 	if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) {
-		DRM_ERROR("Could not find map\n");
+		drm_err(dev, "Could not find map\n");
 		return -EINVAL;
 	}