summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2023-01-23 15:41:58 +0100
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-19 18:27:44 -0500
commit09a68b4a76e3d870d2fad34099d27cc7e2c9939b (patch)
tree596e26f2ea8fc8ea1f06a0a250257ad417b3a790
parent19431b029b8b5d095e77767f269cb142c687084e (diff)
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: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-rw-r--r--drivers/gpu/drm/xe/xe_device.c2
-rw-r--r--drivers/gpu/drm/xe/xe_device_types.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 9881b591bfdd..98f08cd9d4b0 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -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)
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index d62ee85bfcbe..81bc293fb240 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -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;