Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Sokolowski <jan.sokolowski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jan Sokolowski <jan.sokolowski@intel.com>,
	Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Subject: [PATCH i-g-t v2 1/2] /lib/xe/xe_eudebug: Add trigger removal method
Date: Thu, 24 Oct 2024 12:08:50 +0000	[thread overview]
Message-ID: <20241024120851.328536-1-jan.sokolowski@intel.com> (raw)

Add method xe_eudebug_debugger_remove_trigger to remove
trigger from list of triggers.

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Signed-off-by: Dominik Grzegorzk <dominik.grzegorzek@intel.com>
---
 lib/xe/xe_eudebug.c | 30 ++++++++++++++++++++++++++++++
 lib/xe/xe_eudebug.h |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 36763a184..74aa26024 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -1226,6 +1226,36 @@ void xe_eudebug_debugger_add_trigger(struct xe_eudebug_debugger *d,
 	igt_debug("added trigger %p\n", t);
 }
 
+/**
+ * xe_eudebug_debugger_remove_trigger:
+ * @d: pointer to the debugger
+ * @type: the type of the event which activates the trigger.
+ * @fn: function to be removed when event of @type was read by the debugger.
+ *
+ * Removes function @fn from the list of triggers activated when event of
+ * @type has been read by worker.
+ */
+void xe_eudebug_debugger_remove_trigger(struct xe_eudebug_debugger *d,
+					int type, xe_eudebug_trigger_fn fn)
+{
+	struct event_trigger *t;
+	bool found = false;
+
+	igt_list_for_each_entry(t, &d->triggers, link) {
+		if (type == t->type && fn == t->fn) {
+			igt_list_del(&t->link);
+			found = true;
+			break;
+		}
+	}
+	if (found) {
+		igt_debug("removed trigger %p\n", t);
+		free(t);
+	} else {
+		igt_debug("trigger of type %d was not removed as it's not in the list\n", type);
+	}
+}
+
 /**
  * xe_eudebug_debugger_start_worker:
  * @d: pointer to the debugger
diff --git a/lib/xe/xe_eudebug.h b/lib/xe/xe_eudebug.h
index 6e4666333..9aadbe847 100644
--- a/lib/xe/xe_eudebug.h
+++ b/lib/xe/xe_eudebug.h
@@ -150,6 +150,8 @@ void xe_eudebug_debugger_detach(struct xe_eudebug_debugger *d);
 void xe_eudebug_debugger_set_data(struct xe_eudebug_debugger *c, void *ptr);
 void xe_eudebug_debugger_add_trigger(struct xe_eudebug_debugger *d, int type,
 				     xe_eudebug_trigger_fn fn);
+void xe_eudebug_debugger_remove_trigger(struct xe_eudebug_debugger *d, int type,
+				     xe_eudebug_trigger_fn fn);
 void xe_eudebug_debugger_signal_stage(struct xe_eudebug_debugger *d, uint64_t stage);
 void xe_eudebug_debugger_wait_stage(struct xe_eudebug_session *s, uint64_t stage);
 
-- 
2.34.1


             reply	other threads:[~2024-10-24 12:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 12:08 Jan Sokolowski [this message]
2024-10-24 12:08 ` [PATCH i-g-t v2 2/2] /tests/intel/xe_eudebug_online: Remove vm_open_trigger on debugger reattachment Jan Sokolowski
2024-10-24 13:18 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] /lib/xe/xe_eudebug: Add trigger removal method Patchwork
2024-10-24 14:41 ` ✓ CI.xeBAT: " Patchwork
2024-10-24 16:27 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-10-25  9:55 ` [PATCH i-g-t v2 1/2] " Grzegorzek, Dominik
2024-10-25 17:56   ` Kamil Konieczny
2024-10-25 15:49 ` ✗ CI.xeFULL: failure for series starting with [i-g-t,v2,1/2] " 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=20241024120851.328536-1-jan.sokolowski@intel.com \
    --to=jan.sokolowski@intel.com \
    --cc=dominik.grzegorzek@intel.com \
    --cc=igt-dev@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