Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH v2 2/2] drm/xe: Use new force-wake guard class in xe_mocs.c
Date: Mon, 18 Nov 2024 19:45:11 +0100	[thread overview]
Message-ID: <20241118184511.258-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20241118184511.258-1-michal.wajdeczko@intel.com>

Start using new xe_fw class to minimize risk of leaking force-wake
references.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
v2: rebased
---
 drivers/gpu/drm/xe/xe_mocs.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_mocs.c b/drivers/gpu/drm/xe/xe_mocs.c
index 54d199b5cfb2..f18aaa6595c7 100644
--- a/drivers/gpu/drm/xe/xe_mocs.c
+++ b/drivers/gpu/drm/xe/xe_mocs.c
@@ -776,19 +776,15 @@ void xe_mocs_dump(struct xe_gt *gt, struct drm_printer *p)
 {
 	struct xe_device *xe = gt_to_xe(gt);
 	struct xe_mocs_info table;
-	unsigned int fw_ref, flags;
+	unsigned int flags;
 
 	flags = get_mocs_settings(xe, &table);
 
 	xe_pm_runtime_get_noresume(xe);
-	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
-	if (!fw_ref)
-		goto err_fw;
 
-	table.ops->dump(&table, flags, gt, p);
+	scoped_guard(xe_fw, gt_to_fw(gt), XE_FW_GT)
+		table.ops->dump(&table, flags, gt, p);
 
-	xe_force_wake_put(gt_to_fw(gt), fw_ref);
-err_fw:
 	xe_pm_runtime_put(xe);
 }
 
-- 
2.43.0


  parent reply	other threads:[~2024-11-18 18:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 18:45 [PATCH v2 0/2] New force-wake guard class Michal Wajdeczko
2024-11-18 18:45 ` [PATCH v2 1/2] drm/xe: Introduce " Michal Wajdeczko
2024-11-19 18:47   ` Rodrigo Vivi
2024-11-19 19:21     ` Raag Jadav
2024-11-19 19:59       ` Lucas De Marchi
2024-11-19 20:26         ` Michal Wajdeczko
2024-11-25 12:11           ` Rodrigo Vivi
2024-11-25 13:53             ` Raag Jadav
2024-11-18 18:45 ` Michal Wajdeczko [this message]
2024-11-19 20:03   ` [PATCH v2 2/2] drm/xe: Use new force-wake guard class in xe_mocs.c Lucas De Marchi
2024-11-19 21:05     ` Michal Wajdeczko
2024-11-21  4:55     ` Matthew Brost
2024-11-21 20:53       ` Lucas De Marchi
2024-11-18 18:54 ` ✓ CI.Patch_applied: success for New force-wake guard class Patchwork
2024-11-18 18:55 ` ✓ CI.checkpatch: " Patchwork
2024-11-18 18:57 ` ✓ CI.KUnit: " Patchwork
2024-11-18 19:20 ` ✓ CI.Build: " Patchwork
2024-11-18 19:23 ` ✓ CI.Hooks: " Patchwork
2024-11-18 19:24 ` ✓ CI.checksparse: " Patchwork
2024-11-19  1:57 ` ✗ CI.FULL: failure " Patchwork
2024-11-19  7:29 ` ✓ CI.BAT: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241118184511.258-3-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox