[PATCH v2 2/2] drm/i915/selftests: Convert atomic_* API calls for i915_active.count refcount_*

Deepak R Varma drv at mailo.com
Sun Dec 25 07:48:05 UTC 2022


Handle the struct i915_active member variable count transition from
atomic_t type to refcount_t type for selftest use cases. Transition the
atomic_*() API calls to their equivalent refcount_*() API calls.

Reported-by: kernel test robot <lkp at intel.com>
Signed-off-by: Deepak R Varma <drv at mailo.com>
---
Please note:
   1. Proposed changes are compile tested only.
   2. This patch 2/2 is required to be applied after patch 1/2 due to
      inter dependency.

Changes in v2:
   1. Patch added to patch series.
   2. Handle build issues Reported-by: kernel test robot <lkp at intel.com>
      Include changes for i915/selftests use cases for atomic_* to refcount_*
      transition.


 drivers/gpu/drm/i915/selftests/i915_active.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_active.c b/drivers/gpu/drm/i915/selftests/i915_active.c
index b61fe850e924..f1eca59e0180 100644
--- a/drivers/gpu/drm/i915/selftests/i915_active.c
+++ b/drivers/gpu/drm/i915/selftests/i915_active.c
@@ -125,9 +125,9 @@ __live_active_setup(struct drm_i915_private *i915)
 		pr_err("i915_active retired before submission!\n");
 		err = -EINVAL;
 	}
-	if (atomic_read(&active->base.count) != count) {
+	if (refcount_read(&active->base.count) != count) {
 		pr_err("i915_active not tracking all requests, found %d, expected %d\n",
-		       atomic_read(&active->base.count), count);
+		       refcount_read(&active->base.count), count);
 		err = -EINVAL;
 	}

@@ -279,7 +279,7 @@ static struct intel_engine_cs *node_to_barrier(struct active_node *it)
 void i915_active_print(struct i915_active *ref, struct drm_printer *m)
 {
 	drm_printf(m, "active %ps:%ps\n", ref->active, ref->retire);
-	drm_printf(m, "\tcount: %d\n", atomic_read(&ref->count));
+	drm_printf(m, "\tcount: %d\n", refcount_read(&ref->count));
 	drm_printf(m, "\tpreallocated barriers? %s\n",
 		   str_yes_no(!llist_empty(&ref->preallocated_barriers)));

@@ -324,7 +324,7 @@ static void active_flush(struct i915_active *ref,
 	spin_lock_irq(fence->lock);
 	__list_del_entry(&active->cb.node);
 	spin_unlock_irq(fence->lock); /* serialise with fence->cb_list */
-	atomic_dec(&ref->count);
+	refcount_dec(&ref->count);

 	GEM_BUG_ON(!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags));
 }
--
2.34.1





More information about the dri-devel mailing list