diff mbox series

[4/7] ndctl: cxl: add common function to disable event trace

Message ID 166318849259.3087953.6822321103087684015.stgit@djiang5-desk3.ch.intel.com
State Superseded
Delegated to: Vishal Verma
Headers show
Series ndctl: cxl: add monitor support for trace events | expand

Commit Message

Dave Jiang Sept. 14, 2022, 8:48 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 39ca5a9c49be..50f9cc428aa7 100644
--- a/cxl/event_trace.c
+++ b/cxl/event_trace.c
@@ -226,3 +226,11 @@  int cxl_event_tracing_enable(struct tracefs_instance *inst, const char **systems
 	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 b4453c393e7a..9931fb32b245 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 **systems);
+int cxl_event_tracing_disable(struct tracefs_instance *inst);
 
 #endif