[PATCH v2 1/8] drm/i915/selftests: Use drm_* prints in mock selftests

Krzysztof Karas <[email protected]>
Newsgroups org.freedesktop.lists.intel-gfx,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Move away from generic pr prints to device context aware drm
versions.

Signed-off-by: Krzysztof Karas <[email protected]>
---
 .../gpu/drm/i915/selftests/i915_sw_fence.c    |  92 +++++++------
 drivers/gpu/drm/i915/selftests/i915_syncmap.c | 129 ++++++++++--------
 drivers/gpu/drm/i915/selftests/scatterlist.c  |  45 +++---
 3 files changed, 144 insertions(+), 122 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
index 6a305322e30d..462704e575f5 100644
--- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
@@ -26,6 +26,8 @@
 #include <linux/delay.h>
 #include <linux/prime_numbers.h>
 
+#include <drm/drm_print.h>
+
 #include "../i915_selftest.h"
 
 static int
@@ -107,7 +109,7 @@ static int test_dag(void *arg)
 		return -ENOMEM;
 
 	if (i915_sw_fence_await_sw_fence_gfp(A, A, GFP_KERNEL) != -EINVAL) {
-		pr_err("recursive cycle not detected (AA)\n");
+		drm_err(NULL, "recursive cycle not detected (AA)\n");
 		goto err_A;
 	}
 
@@ -119,7 +121,7 @@ static int test_dag(void *arg)
 
 	i915_sw_fence_await_sw_fence_gfp(A, B, GFP_KERNEL);
 	if (i915_sw_fence_await_sw_fence_gfp(B, A, GFP_KERNEL) != -EINVAL) {
-		pr_err("single depth cycle not detected (BAB)\n");
+		drm_err(NULL, "single depth cycle not detected (BAB)\n");
 		goto err_B;
 	}
 
@@ -130,19 +132,19 @@ static int test_dag(void *arg)
 	}
 
 	if (i915_sw_fence_await_sw_fence_gfp(B, C, GFP_KERNEL) == -EINVAL) {
-		pr_err("invalid cycle detected\n");
+		drm_err(NULL, "invalid cycle detected\n");
 		goto err_C;
 	}
 	if (i915_sw_fence_await_sw_fence_gfp(C, B, GFP_KERNEL) != -EINVAL) {
-		pr_err("single depth cycle not detected (CBC)\n");
+		drm_err(NULL, "single depth cycle not detected (CBC)\n");
 		goto err_C;
 	}
 	if (i915_sw_fence_await_sw_fence_gfp(C, A, GFP_KERNEL) != -EINVAL) {
-		pr_err("cycle not detected (BA, CB, AC)\n");
+		drm_err(NULL, "cycle not detected (BA, CB, AC)\n");
 		goto err_C;
 	}
 	if (i915_sw_fence_await_sw_fence_gfp(A, C, GFP_KERNEL) == -EINVAL) {
-		pr_err("invalid cycle detected\n");
+		drm_err(NULL, "invalid cycle detected\n");
 		goto err_C;
 	}
 
@@ -152,15 +154,15 @@ static int test_dag(void *arg)
 
 	ret = 0;
 	if (!i915_sw_fence_done(C)) {
-		pr_err("fence C not done\n");
+		drm_err(NULL, "fence C not done\n");
 		ret = -EINVAL;
 	}
 	if (!i915_sw_fence_done(B)) {
-		pr_err("fence B not done\n");
+		drm_err(NULL, "fence B not done\n");
 		ret = -EINVAL;
 	}
 	if (!i915_sw_fence_done(A)) {
-		pr_err("fence A not done\n");
+		drm_err(NULL, "fence A not done\n");
 		ret = -EINVAL;
 	}
 err_C:
@@ -191,7 +193,7 @@ static int test_AB(void *arg)
 	if (ret < 0)
 		goto err_B;
 	if (ret == 0) {
-		pr_err("Incorrectly reported fence A was complete before await\n");
+		drm_err(NULL, "Incorrectly reported fence A was complete before await\n");
 		ret = -EINVAL;
 		goto err_B;
 	}
@@ -203,12 +205,12 @@ static int test_AB(void *arg)
 
 	i915_sw_fence_commit(B);
 	if (!i915_sw_fence_done(B)) {
-		pr_err("Fence B is not done\n");
+		drm_err(NULL, "Fence B is not done\n");
 		goto err_B;
 	}
 
 	if (!i915_sw_fence_done(A)) {
-		pr_err("Fence A is not done\n");
+		drm_err(NULL, "Fence A is not done\n");
 		goto err_B;
 	}
 
@@ -246,7 +248,7 @@ static int test_ABC(void *arg)
 	if (ret < 0)
 		goto err_C;
 	if (ret == 0) {
-		pr_err("Incorrectly reported fence B was complete before await\n");
+		drm_err(NULL, "Incorrectly reported fence B was complete before await\n");
 		goto err_C;
 	}
 
@@ -254,25 +256,25 @@ static int test_ABC(void *arg)
 	if (ret < 0)
 		goto err_C;
 	if (ret == 0) {
-		pr_err("Incorrectly reported fence C was complete before await\n");
+		drm_err(NULL, "Incorrectly reported fence C was complete before await\n");
 		goto err_C;
 	}
 
 	ret = -EINVAL;
 	i915_sw_fence_commit(A);
 	if (i915_sw_fence_done(A)) {
-		pr_err("Fence A completed early\n");
+		drm_err(NULL, "Fence A completed early\n");
 		goto err_C;
 	}
 
 	i915_sw_fence_commit(B);
 	if (i915_sw_fence_done(B)) {
-		pr_err("Fence B completed early\n");
+		drm_err(NULL, "Fence B completed early\n");
 		goto err_C;
 	}
 
 	if (i915_sw_fence_done(A)) {
-		pr_err("Fence A completed early (after signaling B)\n");
+		drm_err(NULL, "Fence A completed early (after signaling B)\n");
 		goto err_C;
 	}
 
@@ -280,15 +282,15 @@ static int test_ABC(void *arg)
 
 	ret = 0;
 	if (!i915_sw_fence_done(C)) {
-		pr_err("Fence C not done\n");
+		drm_err(NULL, "Fence C not done\n");
 		ret = -EINVAL;
 	}
 	if (!i915_sw_fence_done(B)) {
-		pr_err("Fence B not done\n");
+		drm_err(NULL, "Fence B not done\n");
 		ret = -EINVAL;
 	}
 	if (!i915_sw_fence_done(A)) {
-		pr_err("Fence A not done\n");
+		drm_err(NULL, "Fence A not done\n");
 		ret = -EINVAL;
 	}
 err_C:
@@ -343,28 +345,28 @@ static int test_AB_C(void *arg)
 
 	ret = 0;
 	if (i915_sw_fence_done(A)) {
-		pr_err("Fence A completed early\n");
+		drm_err(NULL, "Fence A completed early\n");
 		ret = -EINVAL;
 	}
 
 	if (i915_sw_fence_done(B)) {
-		pr_err("Fence B completed early\n");
+		drm_err(NULL, "Fence B completed early\n");
 		ret = -EINVAL;
 	}
 
 	i915_sw_fence_commit(C);
 	if (!i915_sw_fence_done(C)) {
-		pr_err("Fence C not done\n");
+		drm_err(NULL, "Fence C not done\n");
 		ret = -EINVAL;
 	}
 
 	if (!i915_sw_fence_done(B)) {
-		pr_err("Fence B not done\n");
+		drm_err(NULL, "Fence B not done\n");
 		ret = -EINVAL;
 	}
 
 	if (!i915_sw_fence_done(A)) {
-		pr_err("Fence A not done\n");
+		drm_err(NULL, "Fence A not done\n");
 		ret = -EINVAL;
 	}
 
@@ -424,17 +426,17 @@ static int test_C_AB(void *arg)
 	i915_sw_fence_commit(B);
 
 	if (!i915_sw_fence_done(A)) {
-		pr_err("Fence A not done\n");
+		drm_err(NULL, "Fence A not done\n");
 		ret = -EINVAL;
 	}
 
 	if (!i915_sw_fence_done(B)) {
-		pr_err("Fence B not done\n");
+		drm_err(NULL, "Fence B not done\n");
 		ret = -EINVAL;
 	}
 
 	if (!i915_sw_fence_done(C)) {
-		pr_err("Fence C not done\n");
+		drm_err(NULL, "Fence C not done\n");
 		ret = -EINVAL;
 	}
 
@@ -483,14 +485,14 @@ static int test_chain(void *arg)
 	for (i = nfences; --i; ) {
 		if (i915_sw_fence_done(fences[i])) {
 			if (ret == 0)
-				pr_err("Fence[%d] completed early\n", i);
+				drm_err(NULL, "Fence[%d] completed early\n", i);
 			ret = -EINVAL;
 		}
 	}
 	i915_sw_fence_commit(fences[0]);
 	for (i = 0; ret == 0 && i < nfences; i++) {
 		if (!i915_sw_fence_done(fences[i])) {
-			pr_err("Fence[%d] is not done\n", i);
+			drm_err(NULL, "Fence[%d] is not done\n", i);
 			ret = -EINVAL;
 		}
 	}
@@ -553,7 +555,7 @@ static int test_ipc(void *arg)
 
 	usleep_range(1000, 2000);
 	if (READ_ONCE(ipc.value)) {
-		pr_err("worker updated value before i915_sw_fence was signaled\n");
+		drm_err(NULL, "worker updated value before i915_sw_fence was signaled\n");
 		ret = -EINVAL;
 	}
 
@@ -561,7 +563,7 @@ static int test_ipc(void *arg)
 	i915_sw_fence_wait(ipc.out);
 
 	if (!READ_ONCE(ipc.value)) {
-		pr_err("worker signaled i915_sw_fence before value was posted\n");
+		drm_err(NULL, "worker signaled i915_sw_fence before value was posted\n");
 		ret = -EINVAL;
 	}
 
@@ -584,7 +586,7 @@ static int test_timer(void *arg)
 	preempt_disable();
 	timed_fence_init(&tf, target = jiffies);
 	if (!i915_sw_fence_done(&tf.fence)) {
-		pr_err("Fence with immediate expiration not signaled\n");
+		drm_err(NULL, "Fence with immediate expiration not signaled\n");
 		goto err;
 	}
 	preempt_enable();
@@ -594,7 +596,9 @@ static int test_timer(void *arg)
 		preempt_disable();
 		timed_fence_init(&tf, target = jiffies + delay);
 		if (i915_sw_fence_done(&tf.fence)) {
-			pr_err("Fence with future expiration (%lu jiffies) already signaled\n", delay);
+			drm_err(NULL,
+				"Fence with future expiration (%lu jiffies) already signaled\n",
+				delay);
 			goto err;
 		}
 		preempt_enable();
@@ -603,12 +607,12 @@ static int test_timer(void *arg)
 
 		preempt_disable();
 		if (!i915_sw_fence_done(&tf.fence)) {
-			pr_err("Fence not signaled after wait\n");
+			drm_err(NULL, "Fence not signaled after wait\n");
 			goto err;
 		}
 		if (time_before(jiffies, target)) {
-			pr_err("Fence signaled too early, target=%lu, now=%lu\n",
-			       target, jiffies);
+			drm_err(NULL, "Fence signaled too early, target=%lu, now=%lu\n",
+				target, jiffies);
 			goto err;
 		}
 		preempt_enable();
@@ -692,7 +696,7 @@ static int test_dma_fence(void *arg)
 
 	err = -EINVAL;
 	if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
-		pr_err("Fences immediately signaled\n");
+		drm_err(NULL, "Fences immediately signaled\n");
 		goto err;
 	}
 
@@ -702,25 +706,25 @@ static int test_dma_fence(void *arg)
 	sleep = jiffies_to_usecs(delay) / 3;
 	usleep_range(sleep, 2 * sleep);
 	if (time_after(jiffies, end)) {
-		pr_debug("Slept too long, delay=%lu, (target=%lu, now=%lu) skipping\n",
-			 delay, end, jiffies);
+		drm_dbg(NULL, "Slept too long, delay=%lu, (target=%lu, now=%lu) skipping\n",
+			delay, end, jiffies);
 		goto skip;
 	}
 
 	if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
-		pr_err("Fences signaled too early\n");
+		drm_err(NULL, "Fences signaled too early\n");
 		goto err;
 	}
 
 	if (!wait_event_timeout(timeout->wait,
 				i915_sw_fence_done(timeout),
 				2 * (end - jiffies) + 1)) {
-		pr_err("Timeout fence unsignaled!\n");
+		drm_err(NULL, "Timeout fence unsignaled!\n");
 		goto err;
 	}
 
 	if (i915_sw_fence_done(not)) {
-		pr_err("No timeout fence signaled!\n");
+		drm_err(NULL, "No timeout fence signaled!\n");
 		goto err;
 	}
 
@@ -728,7 +732,7 @@ static int test_dma_fence(void *arg)
 	dma_fence_signal(dma);
 
 	if (!i915_sw_fence_done(timeout) || !i915_sw_fence_done(not)) {
-		pr_err("Fences unsignaled\n");
+		drm_err(NULL, "Fences unsignaled\n");
 		goto err;
 	}
 
diff --git a/drivers/gpu/drm/i915/selftests/i915_syncmap.c b/drivers/gpu/drm/i915/selftests/i915_syncmap.c
index 88fa845e9f4a..3eae3c6fa312 100644
--- a/drivers/gpu/drm/i915/selftests/i915_syncmap.c
+++ b/drivers/gpu/drm/i915/selftests/i915_syncmap.c
@@ -25,6 +25,8 @@
 #include "../i915_selftest.h"
 #include "i915_random.h"
 
+#include <drm/drm_print.h>
+
 static char *
 __sync_print(struct i915_syncmap *p,
 	     char *buf, unsigned long *sz,
@@ -102,7 +104,7 @@ static int check_syncmap_free(struct i915_syncmap **sync)
 {
 	i915_syncmap_free(sync);
 	if (*sync) {
-		pr_err("sync not cleared after free\n");
+		drm_err(NULL, "sync not cleared after free\n");
 		return -EINVAL;
 	}
 
@@ -121,7 +123,7 @@ static int dump_syncmap(struct i915_syncmap *sync, int err)
 		goto skip;
 
 	if (i915_syncmap_print_to_buf(sync, buf, PAGE_SIZE))
-		pr_err("%s", buf);
+		drm_err(NULL, "%s", buf);
 
 	kfree(buf);
 
@@ -146,14 +148,13 @@ static int igt_syncmap_init(void *arg)
 static int check_seqno(struct i915_syncmap *leaf, unsigned int idx, u32 seqno)
 {
 	if (leaf->height) {
-		pr_err("%s: not a leaf, height is %d\n",
-		       __func__, leaf->height);
+		drm_err(NULL, "%s: not a leaf, height is %d\n", __func__, leaf->height);
 		return -EINVAL;
 	}
 
 	if (__sync_seqno(leaf)[idx] != seqno) {
-		pr_err("%s: seqno[%d], found %x, expected %x\n",
-		       __func__, idx, __sync_seqno(leaf)[idx], seqno);
+		drm_err(NULL, "%s: seqno[%d], found %x, expected %x\n",
+			__func__, idx, __sync_seqno(leaf)[idx], seqno);
 		return -EINVAL;
 	}
 
@@ -169,20 +170,21 @@ static int check_one(struct i915_syncmap **sync, u64 context, u32 seqno)
 		return err;
 
 	if ((*sync)->height) {
-		pr_err("Inserting first context=%llx did not return leaf (height=%d, prefix=%llx\n",
-		       context, (*sync)->height, (*sync)->prefix);
+		drm_err(NULL,
+			"Inserting first context=%llx did not return leaf (height=%d, prefix=%llx\n",
+			context, (*sync)->height, (*sync)->prefix);
 		return -EINVAL;
 	}
 
 	if ((*sync)->parent) {
-		pr_err("Inserting first context=%llx created branches!\n",
-		       context);
+		drm_err(NULL, "Inserting first context=%llx created branches!\n", context);
 		return -EINVAL;
 	}
 
 	if (hweight32((*sync)->bitmap) != 1) {
-		pr_err("First bitmap does not contain a single entry, found %x (count=%d)!\n",
-		       (*sync)->bitmap, hweight32((*sync)->bitmap));
+		drm_err(NULL,
+			"First bitmap does not contain a single entry, found %x (count=%d)!\n",
+			(*sync)->bitmap, hweight32((*sync)->bitmap));
 		return -EINVAL;
 	}
 
@@ -191,8 +193,7 @@ static int check_one(struct i915_syncmap **sync, u64 context, u32 seqno)
 		return err;
 
 	if (!i915_syncmap_is_later(sync, context, seqno)) {
-		pr_err("Lookup of first context=%llx/seqno=%x failed!\n",
-		       context, seqno);
+		drm_err(NULL, "Lookup of first context=%llx/seqno=%x failed!\n", context, seqno);
 		return -EINVAL;
 	}
 
@@ -229,8 +230,8 @@ static int igt_syncmap_one(void *arg)
 		}
 		max++;
 	} while (!__igt_timeout(end_time, NULL));
-	pr_debug("%s: Completed %lu single insertions\n",
-		 __func__, max * (max - 1) / 2);
+	drm_dbg(NULL, "%s: Completed %lu single insertions\n",
+		__func__, max * (max - 1) / 2);
 out:
 	return dump_syncmap(sync, err);
 }
@@ -244,14 +245,16 @@ static int check_leaf(struct i915_syncmap **sync, u64 context, u32 seqno)
 		return err;
 
 	if ((*sync)->height) {
-		pr_err("Inserting context=%llx did not return leaf (height=%d, prefix=%llx\n",
-		       context, (*sync)->height, (*sync)->prefix);
+		drm_err(NULL,
+			"Inserting context=%llx did not return leaf (height=%d, prefix=%llx\n",
+			context, (*sync)->height, (*sync)->prefix);
 		return -EINVAL;
 	}
 
 	if (hweight32((*sync)->bitmap) != 1) {
-		pr_err("First entry into leaf (context=%llx) does not contain a single entry, found %x (count=%d)!\n",
-		       context, (*sync)->bitmap, hweight32((*sync)->bitmap));
+		drm_err(NULL,
+			"First entry into leaf (context=%llx) does not contain a single entry, found %x (count=%d)!\n",
+			context, (*sync)->bitmap, hweight32((*sync)->bitmap));
 		return -EINVAL;
 	}
 
@@ -260,8 +263,8 @@ static int check_leaf(struct i915_syncmap **sync, u64 context, u32 seqno)
 		return err;
 
 	if (!i915_syncmap_is_later(sync, context, seqno)) {
-		pr_err("Lookup of first entry context=%llx/seqno=%x failed!\n",
-		       context, seqno);
+		drm_err(NULL, "Lookup of first entry context=%llx/seqno=%x failed!\n",
+			context, seqno);
 		return -EINVAL;
 	}
 
@@ -306,20 +309,20 @@ static int igt_syncmap_join_above(void *arg)
 				continue;
 
 			if (!join->height) {
-				pr_err("Parent with no height!\n");
+				drm_err(NULL, "Parent with no height!\n");
 				err = -EINVAL;
 				goto out;
 			}
 
 			if (hweight32(join->bitmap) != 2) {
-				pr_err("Join does not have 2 children: %x (%d)\n",
-				       join->bitmap, hweight32(join->bitmap));
+				drm_err(NULL, "Join does not have 2 children: %x (%d)\n",
+					join->bitmap, hweight32(join->bitmap));
 				err = -EINVAL;
 				goto out;
 			}
 
 			if (__sync_child(join)[__sync_branch_idx(join, context)] != sync) {
-				pr_err("Leaf misplaced in parent!\n");
+				drm_err(NULL, "Leaf misplaced in parent!\n");
 				err = -EINVAL;
 				goto out;
 			}
@@ -350,8 +353,9 @@ static int igt_syncmap_join_below(void *arg)
 				goto out;
 
 			if (sync->height) {
-				pr_err("Inserting context=%llx (order=%d, step=%d) did not return leaf (height=%d, prefix=%llx\n",
-				       context, order, step, sync->height, sync->prefix);
+				drm_err(NULL,
+					"Inserting context=%llx (order=%d, step=%d) did not return leaf (height=%d, prefix=%llx\n",
+					context, order, step, sync->height, sync->prefix);
 				err = -EINVAL;
 				goto out;
 			}
@@ -363,16 +367,17 @@ static int igt_syncmap_join_below(void *arg)
 			u64 context = step * BIT_ULL(order);
 
 			if (!i915_syncmap_is_later(&sync, context, 0)) {
-				pr_err("1: context %llx (order=%d, step=%d) not found\n",
-				       context, order, step);
+				drm_err(NULL, "1: context %llx (order=%d, step=%d) not found\n",
+					context, order, step);
 				err = -EINVAL;
 				goto out;
 			}
 
 			for (idx = 1; idx < KSYNCMAP; idx++) {
 				if (i915_syncmap_is_later(&sync, context + idx, 0)) {
-					pr_err("1: context %llx (order=%d, step=%d) should not exist\n",
-					       context + idx, order, step);
+					drm_err(NULL,
+						"1: context %llx (order=%d, step=%d) should not exist\n",
+						context + idx, order, step);
 					err = -EINVAL;
 					goto out;
 				}
@@ -385,8 +390,8 @@ static int igt_syncmap_join_below(void *arg)
 			u64 context = step * BIT_ULL(order);
 
 			if (!i915_syncmap_is_later(&sync, context, 0)) {
-				pr_err("2: context %llx (order=%d, step=%d) not found\n",
-				       context, order, step);
+				drm_err(NULL, "2: context %llx (order=%d, step=%d) not found\n",
+					context, order, step);
 				err = -EINVAL;
 				goto out;
 			}
@@ -423,17 +428,19 @@ static int igt_syncmap_neighbours(void *arg)
 				goto out;
 
 			if (sync->height) {
-				pr_err("Inserting context=%llx did not return leaf (height=%d, prefix=%llx\n",
-				       context, sync->height, sync->prefix);
+				drm_err(NULL,
+					"Inserting context=%llx did not return leaf (height=%d, prefix=%llx\n",
+					context, sync->height, sync->prefix);
 				err = -EINVAL;
 				goto out;
 			}
 
 			if (sync->bitmap != BIT(idx + 1) - 1) {
-				pr_err("Inserting neighbouring context=0x%llx+%d, did not fit into the same leaf bitmap=%x (%d), expected %lx (%d)\n",
-				       context, idx,
-				       sync->bitmap, hweight32(sync->bitmap),
-				       BIT(idx + 1) - 1, idx + 1);
+				drm_err(NULL,
+					"Inserting neighbouring context=0x%llx+%d, did not fit into the same leaf bitmap=%x (%d), expected %lx (%d)\n",
+					context, idx,
+					sync->bitmap, hweight32(sync->bitmap),
+					BIT(idx + 1) - 1, idx + 1);
 				err = -EINVAL;
 				goto out;
 			}
@@ -473,9 +480,10 @@ static int igt_syncmap_compact(void *arg)
 				goto out;
 
 			if (sync->height) {
-				pr_err("Inserting context=%llx (order=%d, idx=%d) did not return leaf (height=%d, prefix=%llx\n",
-				       context, order, idx,
-				       sync->height, sync->prefix);
+				drm_err(NULL,
+					"Inserting context=%llx (order=%d, idx=%d) did not return leaf (height=%d, prefix=%llx\n",
+					context, order, idx,
+					sync->height, sync->prefix);
 				err = -EINVAL;
 				goto out;
 			}
@@ -483,22 +491,23 @@ static int igt_syncmap_compact(void *arg)
 
 		sync = sync->parent;
 		if (sync->parent) {
-			pr_err("Parent (join) of last leaf was not the sync!\n");
+			drm_err(NULL, "Parent (join) of last leaf was not the sync!\n");
 			err = -EINVAL;
 			goto out;
 		}
 
 		if (sync->height != order) {
-			pr_err("Join does not have the expected height, found %d, expected %d\n",
-			       sync->height, order);
+			drm_err(NULL,
+				"Join does not have the expected height, found %d, expected %d\n",
+				sync->height, order);
 			err = -EINVAL;
 			goto out;
 		}
 
 		if (sync->bitmap != BIT(KSYNCMAP) - 1) {
-			pr_err("Join is not full!, found %x (%d) expected %lx (%d)\n",
-			       sync->bitmap, hweight32(sync->bitmap),
-			       BIT(KSYNCMAP) - 1, KSYNCMAP);
+			drm_err(NULL, "Join is not full!, found %x (%d) expected %lx (%d)\n",
+				sync->bitmap, hweight32(sync->bitmap),
+				BIT(KSYNCMAP) - 1, KSYNCMAP);
 			err = -EINVAL;
 			goto out;
 		}
@@ -508,28 +517,28 @@ static int igt_syncmap_compact(void *arg)
 			struct i915_syncmap *leaf = __sync_child(sync)[idx];
 
 			if (leaf->height) {
-				pr_err("Child %d is a not leaf!\n", idx);
+				drm_err(NULL, "Child %d is a not leaf!\n", idx);
 				err = -EINVAL;
 				goto out;
 			}
 
 			if (leaf->parent != sync) {
-				pr_err("Child %d is not attached to us!\n",
-				       idx);
+				drm_err(NULL, "Child %d is not attached to us!\n", idx);
 				err = -EINVAL;
 				goto out;
 			}
 
 			if (!is_power_of_2(leaf->bitmap)) {
-				pr_err("Child %d holds more than one id, found %x (%d)\n",
-				       idx, leaf->bitmap, hweight32(leaf->bitmap));
+				drm_err(NULL, "Child %d holds more than one id, found %x (%d)\n",
+					idx, leaf->bitmap, hweight32(leaf->bitmap));
 				err = -EINVAL;
 				goto out;
 			}
 
 			if (leaf->bitmap != BIT(idx)) {
-				pr_err("Child %d has wrong seqno idx, found %d, expected %d\n",
-				       idx, ilog2(leaf->bitmap), idx);
+				drm_err(NULL,
+					"Child %d has wrong seqno idx, found %d, expected %d\n",
+					idx, ilog2(leaf->bitmap), idx);
 				err = -EINVAL;
 				goto out;
 			}
@@ -582,8 +591,9 @@ static int igt_syncmap_random(void *arg)
 			u64 context = i915_prandom_u64_state(&ctx);
 
 			if (i915_syncmap_is_later(&sync, context, seqno) != expect) {
-				pr_err("context=%llu, last=%u this=%u did not match expectation (%d)\n",
-				       context, last_seqno, seqno, expect);
+				drm_err(NULL,
+					"context=%llu, last=%u this=%u did not match expectation (%d)\n",
+					context, last_seqno, seqno, expect);
 				err = -EINVAL;
 				goto out;
 			}
@@ -595,7 +605,8 @@ static int igt_syncmap_random(void *arg)
 
 		phase++;
 	} while (!__igt_timeout(end_time, NULL));
-	pr_debug("Completed %lu passes, each of %lu contexts\n", phase, count);
+	drm_dbg(NULL, "Completed %lu passes, each of %lu contexts\n",
+		phase, count);
 out:
 	return dump_syncmap(sync, err);
 }
diff --git a/drivers/gpu/drm/i915/selftests/scatterlist.c b/drivers/gpu/drm/i915/selftests/scatterlist.c
index 7e59591bbed6..d8fbe5a8060b 100644
--- a/drivers/gpu/drm/i915/selftests/scatterlist.c
+++ b/drivers/gpu/drm/i915/selftests/scatterlist.c
@@ -24,6 +24,8 @@
 #include <linux/prime_numbers.h>
 #include <linux/prandom.h>
 
+#include <drm/drm_print.h>
+
 #include "i915_selftest.h"
 #include "i915_utils.h"
 
@@ -53,14 +55,16 @@ static noinline int expect_pfn_sg(struct pfn_table *pt,
 		unsigned int npages = npages_fn(n, pt->st.nents, rnd);
 
 		if (page_to_pfn(page) != pfn) {
-			pr_err("%s: %s left pages out of order, expected pfn %lu, found pfn %lu (using for_each_sg)\n",
-			       __func__, who, pfn, page_to_pfn(page));
+			drm_err(NULL,
+				"%s: %s left pages out of order, expected pfn %lu, found pfn %lu (using for_each_sg)\n",
+				__func__, who, pfn, page_to_pfn(page));
 			return -EINVAL;
 		}
 
 		if (sg->length != npages * PAGE_SIZE) {
-			pr_err("%s: %s copied wrong sg length, expected size %lu, found %u (using for_each_sg)\n",
-			       __func__, who, npages * PAGE_SIZE, sg->length);
+			drm_err(NULL,
+				"%s: %s copied wrong sg length, expected size %lu, found %u (using for_each_sg)\n",
+				__func__, who, npages * PAGE_SIZE, sg->length);
 			return -EINVAL;
 		}
 
@@ -70,8 +74,8 @@ static noinline int expect_pfn_sg(struct pfn_table *pt,
 		pfn += npages;
 	}
 	if (pfn != pt->end) {
-		pr_err("%s: %s finished on wrong pfn, expected %lu, found %lu\n",
-		       __func__, who, pt->end, pfn);
+		drm_err(NULL, "%s: %s finished on wrong pfn, expected %lu, found %lu\n",
+			__func__, who, pt->end, pfn);
 		return -EINVAL;
 	}
 
@@ -90,8 +94,9 @@ static noinline int expect_pfn_sg_page_iter(struct pfn_table *pt,
 		struct page *page = sg_page_iter_page(&sgiter);
 
 		if (page != pfn_to_page(pfn)) {
-			pr_err("%s: %s left pages out of order, expected pfn %lu, found pfn %lu (using for_each_sg_page)\n",
-			       __func__, who, pfn, page_to_pfn(page));
+			drm_err(NULL,
+				"%s: %s left pages out of order, expected pfn %lu, found pfn %lu (using for_each_sg_page)\n",
+				__func__, who, pfn, page_to_pfn(page));
 			return -EINVAL;
 		}
 
@@ -101,8 +106,8 @@ static noinline int expect_pfn_sg_page_iter(struct pfn_table *pt,
 		pfn++;
 	}
 	if (pfn != pt->end) {
-		pr_err("%s: %s finished on wrong pfn, expected %lu, found %lu\n",
-		       __func__, who, pt->end, pfn);
+		drm_err(NULL, "%s: %s finished on wrong pfn, expected %lu, found %lu\n",
+			__func__, who, pt->end, pfn);
 		return -EINVAL;
 	}
 
@@ -120,8 +125,9 @@ static noinline int expect_pfn_sgtiter(struct pfn_table *pt,
 	pfn = pt->start;
 	for_each_sgt_page(page, sgt, &pt->st) {
 		if (page != pfn_to_page(pfn)) {
-			pr_err("%s: %s left pages out of order, expected pfn %lu, found pfn %lu (using for_each_sgt_page)\n",
-			       __func__, who, pfn, page_to_pfn(page));
+			drm_err(NULL,
+				"%s: %s left pages out of order, expected pfn %lu, found pfn %lu (using for_each_sgt_page)\n",
+				__func__, who, pfn, page_to_pfn(page));
 			return -EINVAL;
 		}
 
@@ -131,8 +137,8 @@ static noinline int expect_pfn_sgtiter(struct pfn_table *pt,
 		pfn++;
 	}
 	if (pfn != pt->end) {
-		pr_err("%s: %s finished on wrong pfn, expected %lu, found %lu\n",
-		       __func__, who, pt->end, pfn);
+		drm_err(NULL, "%s: %s finished on wrong pfn, expected %lu, found %lu\n",
+			__func__, who, pt->end, pfn);
 		return -EINVAL;
 	}
 
@@ -275,7 +281,7 @@ static const npages_fn_t npages_funcs[] = {
 	NULL,
 };
 
-static int igt_sg_alloc(void *ignored)
+static int igt_sg_alloc(void *arg)
 {
 	IGT_TIMEOUT(end_time);
 	const unsigned long max_order = 20; /* approximating a 4GiB object */
@@ -305,7 +311,7 @@ static int igt_sg_alloc(void *ignored)
 
 				prandom_seed_state(&prng,
 						   i915_selftest.random_seed);
-				err = expect_pfn_sgtable(&pt, *npages, &prng,
+					err = expect_pfn_sgtable(&pt, *npages, &prng,
 							 "sg_alloc_table",
 							 end_time);
 				sg_free_table(&pt.st);
@@ -322,7 +328,7 @@ static int igt_sg_alloc(void *ignored)
 	return 0;
 }
 
-static int igt_sg_trim(void *ignored)
+static int igt_sg_trim(void *arg)
 {
 	IGT_TIMEOUT(end_time);
 	const unsigned long max = PAGE_SIZE; /* not prime! */
@@ -348,8 +354,9 @@ static int igt_sg_trim(void *ignored)
 			if (i915_sg_trim(&pt.st)) {
 				if (pt.st.orig_nents != prime ||
 				    pt.st.nents != prime) {
-					pr_err("i915_sg_trim failed (nents %u, orig_nents %u), expected %lu\n",
-					       pt.st.nents, pt.st.orig_nents, prime);
+					drm_err(NULL,
+						"i915_sg_trim failed (nents %u, orig_nents %u), expected %lu\n",
+						pt.st.nents, pt.st.orig_nents, prime);
 					err = -EINVAL;
 				} else {
 					prandom_seed_state(&prng,
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.