]> www.infradead.org Git - linux.git/commitdiff
drm/xe: Change return type to void for xe_force_wake_put
authorHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Mon, 14 Oct 2024 07:56:01 +0000 (13:26 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 17 Oct 2024 14:17:10 +0000 (10:17 -0400)
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)

v8
- Fix kernel-doc

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241014075601.2324382-27-himal.prasad.ghimiray@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_force_wake.c
drivers/gpu/drm/xe/xe_force_wake.h

index c60db78c44e67a7c388c57585a54a7a0d1a85f1f..f5067dea59c9f301540ef0bddba638f9c12339d3 100644 (file)
@@ -211,8 +211,17 @@ unsigned int __must_check xe_force_wake_get(struct xe_force_wake *fw,
        return 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
+ * @fw_ref: return of xe_force_wake_get()
+ *
+ * This function reduces the reference counts for domains in fw_ref. 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.
+ * 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;
@@ -225,7 +234,7 @@ int xe_force_wake_put(struct xe_force_wake *fw,
         * in error path of individual domains.
         */
        if (!fw_ref)
-               return 0;
+               return;
 
        if (xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
                fw_ref = fw->initialized_domains;
@@ -249,5 +258,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;
 }
index 70faec9ae2d9e43f3b24790d619c63a418129c67..0e3e84bfa51c38c525e16cbc9d85371b8c586865 100644 (file)
@@ -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,