diff mbox series

[2/2] drm/i915/gt: use fetch_and_zero if applicable

Message ID 20221208111217.3734461-2-andrzej.hajda@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/display: use fetch_and_zero if applicable | expand

Commit Message

Andrzej Hajda Dec. 8, 2022, 11:12 a.m. UTC
Simplify the code.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_context.c        | 6 ++----
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/selftest_context.c b/drivers/gpu/drm/i915/gt/selftest_context.c
index 76fbae358072df..307dbbe853a3e9 100644
--- a/drivers/gpu/drm/i915/gt/selftest_context.c
+++ b/drivers/gpu/drm/i915/gt/selftest_context.c
@@ -227,8 +227,7 @@  static int __live_active_context(struct intel_engine_cs *engine)
 	if (IS_ERR(ce))
 		return PTR_ERR(ce);
 
-	saved_heartbeat = engine->props.heartbeat_interval_ms;
-	engine->props.heartbeat_interval_ms = 0;
+	saved_heartbeat = fetch_and_zero(&engine->props.heartbeat_interval_ms);
 
 	for (pass = 0; pass <= 2; pass++) {
 		struct i915_request *rq;
@@ -385,8 +384,7 @@  static int __live_remote_context(struct intel_engine_cs *engine)
 		goto err_remote;
 	}
 
-	saved_heartbeat = engine->props.heartbeat_interval_ms;
-	engine->props.heartbeat_interval_ms = 0;
+	saved_heartbeat = fetch_and_zero(&engine->props.heartbeat_interval_ms);
 	intel_engine_pm_get(engine);
 
 	for (pass = 0; pass <= 2; pass++) {
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 53f7f599cde3a2..f9dd77838917f6 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -4747,8 +4747,7 @@  static void reset_fail_worker_func(struct work_struct *w)
 	unsigned long flags;
 
 	spin_lock_irqsave(&guc->submission_state.lock, flags);
-	reset_fail_mask = guc->submission_state.reset_fail_mask;
-	guc->submission_state.reset_fail_mask = 0;
+	reset_fail_mask = fetch_and_zero(&guc->submission_state.reset_fail_mask);
 	spin_unlock_irqrestore(&guc->submission_state.lock, flags);
 
 	if (likely(reset_fail_mask))