Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Change return type to void for xe_force_wake_put

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>

authored by

Himal Prasad Ghimiray and committed by
Rodrigo Vivi
76eb09c8 9ee17807

+13 -6
+12 -4
drivers/gpu/drm/xe/xe_force_wake.c
··· 211 211 return ref_incr; 212 212 } 213 213 214 - int xe_force_wake_put(struct xe_force_wake *fw, 215 - unsigned int fw_ref) 214 + /** 215 + * xe_force_wake_put - Decrement the refcount and put domain to sleep if refcount becomes 0 216 + * @fw: Pointer to the force wake structure 217 + * @fw_ref: return of xe_force_wake_get() 218 + * 219 + * This function reduces the reference counts for domains in fw_ref. If 220 + * refcount for any of the specified domain reaches 0, it puts the domain to sleep 221 + * and waits for acknowledgment for domain to sleep within 50 milisec timeout. 222 + * Warns in case of timeout of ack from domain. 223 + */ 224 + void xe_force_wake_put(struct xe_force_wake *fw, unsigned int fw_ref) 216 225 { 217 226 struct xe_gt *gt = fw->gt; 218 227 struct xe_force_wake_domain *domain; ··· 234 225 * in error path of individual domains. 235 226 */ 236 227 if (!fw_ref) 237 - return 0; 228 + return; 238 229 239 230 if (xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) 240 231 fw_ref = fw->initialized_domains; ··· 258 249 259 250 xe_gt_WARN(gt, ack_fail, "Forcewake domain%s %#x failed to acknowledge sleep request\n", 260 251 str_plural(hweight_long(ack_fail)), ack_fail); 261 - return ack_fail; 262 252 }
+1 -2
drivers/gpu/drm/xe/xe_force_wake.h
··· 17 17 struct xe_force_wake *fw); 18 18 unsigned int __must_check xe_force_wake_get(struct xe_force_wake *fw, 19 19 enum xe_force_wake_domains domains); 20 - int xe_force_wake_put(struct xe_force_wake *fw, 21 - unsigned int fw_ref); 20 + void xe_force_wake_put(struct xe_force_wake *fw, unsigned int fw_ref); 22 21 23 22 static inline int 24 23 xe_force_wake_ref(struct xe_force_wake *fw,