diff mbox series

[v2,4/9] cxl: add common function to disable event trace

Message ID 166363121739.3861186.14270734583823747080.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State New, archived
Headers show
Series cxl: add monitor support for trace events | expand

Commit Message

Dave Jiang Sept. 19, 2022, 11:46 p.m. UTC
Add a common function for cxl command that disables the event trace for the
instance created.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 cxl/event_trace.c |    8 ++++++++
 cxl/event_trace.h |    1 +
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/cxl/event_trace.c b/cxl/event_trace.c
index ca2fb94f2eba..33d6812510a3 100644
--- a/cxl/event_trace.c
+++ b/cxl/event_trace.c
@@ -218,3 +218,11 @@  int cxl_event_tracing_enable(struct tracefs_instance *inst, const char *system)
 	tracefs_trace_on(inst);
 	return 0;
 }
+
+int cxl_event_tracing_disable(struct tracefs_instance *inst)
+{
+	if (!tracefs_trace_is_on(inst))
+		return 0;
+
+	return tracefs_trace_off(inst);
+}
diff --git a/cxl/event_trace.h b/cxl/event_trace.h
index 1fb905664625..9aafa942bbb2 100644
--- a/cxl/event_trace.h
+++ b/cxl/event_trace.h
@@ -18,5 +18,6 @@  struct event_ctx {
 
 int cxl_parse_events(struct tracefs_instance *inst, struct event_ctx *ectx);
 int cxl_event_tracing_enable(struct tracefs_instance *inst, const char *system);
+int cxl_event_tracing_disable(struct tracefs_instance *inst);
 
 #endif