From: Maarten Lankhorst Date: Mon, 23 Jan 2023 14:41:58 +0000 (+0100) Subject: drm/xe: Convert memory device refcount to s32 X-Git-Tag: v6.8-rc1~111^2~7^2~974 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09a68b4a76e3d870d2fad34099d27cc7e2c9939b;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Rodrigo Vivi Signed-off-by: Rodrigo Vivi --- diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 9881b591bfdd3..98f08cd9d4b01 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 d62ee85bfcbe0..81bc293fb240c 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;