Commit 09a68b4a authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Rodrigo Vivi
Browse files

drm/xe: Convert memory device refcount to s32



The comparison with < 0 suggests that the memory device access
should be signed to handle underflow. This makes it work more reliably.

As a result, the max refcount is now S32_MAX instead.

Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 19431b02
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ void xe_device_mem_access_get(struct xe_device *xe)
	if (resumed)
		xe_pm_runtime_put(xe);

	XE_WARN_ON(xe->mem_access.ref == U32_MAX);
	XE_WARN_ON(xe->mem_access.ref == S32_MAX);
}

void xe_device_mem_access_put(struct xe_device *xe)
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ struct xe_device {
		/** @lock: protect the ref count */
		struct mutex lock;
		/** @ref: ref count of memory accesses */
		u32 ref;
		s32 ref;
		/** @hold_rpm: need to put rpm ref back at the end */
		bool hold_rpm;
	} mem_access;