[PATCH v7 26/26] drm/xe: Change return type to void for xe_force_wake_put
Himal Prasad Ghimiray
himal.prasad.ghimiray at intel.com
Mon Oct 7 07:00:17 UTC 2024
There is no need to return an error from xe_force_wake_put(), as a
failure implicitly indicates that the domain failed to sleep.
v3
- Move kernel-doc to this patch (Badal)
v5
- change parameter to unsigned int in xe_force_wake_put()
v6
- Remove unneccsary wrapping (Michal)
- Remove non required header (Michal)
- Mention timeout(Michal)
Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Badal Nilawar <badal.nilawar at intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Nirmoy Das <nirmoy.das at intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar at intel.com>(#rev5)
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
---
drivers/gpu/drm/xe/xe_force_wake.c | 18 ++++++++++++++----
drivers/gpu/drm/xe/xe_force_wake.h | 3 +--
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/xe/xe_force_wake.c
index 5d749bad9496..7b82e7c7d662 100644
--- a/drivers/gpu/drm/xe/xe_force_wake.c
+++ b/drivers/gpu/drm/xe/xe_force_wake.c
@@ -212,8 +212,19 @@ unsigned int __must_check xe_force_wake_get(struct xe_force_wake *fw,
return (ref_incr == fw->initialized_domains) ? ref_incr | XE_FORCEWAKE_ALL : ref_incr;
}
-int xe_force_wake_put(struct xe_force_wake *fw,
- unsigned int fw_ref)
+/**
+ * xe_force_wake_put - Decrement the refcount and put domain to sleep if refcount becomes 0
+ * @fw: Pointer to the force wake structure
+ * @domains_mask: forcewake domain mask to put reference
+ *
+ * This function reduces the reference counts for specified domain mask. If
+ * refcount for any of the specified domain reaches 0, it puts the domain to sleep
+ * and waits for acknowledgment for domain to sleep within 50 milisec timeout.
+ * Ensure this function is always called with return of xe_force_wake_get() as
+ * @domains_mask.
+ * Warns in case of timeout of ack from domain.
+ */
+void xe_force_wake_put(struct xe_force_wake *fw, unsigned int fw_ref)
{
struct xe_gt *gt = fw->gt;
struct xe_force_wake_domain *domain;
@@ -226,7 +237,7 @@ int xe_force_wake_put(struct xe_force_wake *fw,
* in error path of individual domains.
*/
if (!fw_ref)
- return 0;
+ return;
if (fw_ref == XE_FORCEWAKE_ALL)
fw_ref = fw->initialized_domains;
@@ -248,5 +259,4 @@ int xe_force_wake_put(struct xe_force_wake *fw,
xe_gt_WARN(gt, ack_fail, "Forcewake domain%s %#x failed to acknowledge sleep request\n",
str_plural(hweight_long(ack_fail)), ack_fail);
- return ack_fail;
}
diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
index 70faec9ae2d9..0e3e84bfa51c 100644
--- a/drivers/gpu/drm/xe/xe_force_wake.h
+++ b/drivers/gpu/drm/xe/xe_force_wake.h
@@ -17,8 +17,7 @@ void xe_force_wake_init_engines(struct xe_gt *gt,
struct xe_force_wake *fw);
unsigned int __must_check xe_force_wake_get(struct xe_force_wake *fw,
enum xe_force_wake_domains domains);
-int xe_force_wake_put(struct xe_force_wake *fw,
- unsigned int fw_ref);
+void xe_force_wake_put(struct xe_force_wake *fw, unsigned int fw_ref);
static inline int
xe_force_wake_ref(struct xe_force_wake *fw,
--
2.34.1
More information about the Intel-xe
mailing list