Merge tag 'v5.5-rc1' into core/kprobes, to resolve conflicts
[linux-2.6-microblaze.git] / kernel / trace / trace_events.c
index 5ab10c3..9745581 100644 (file)
@@ -794,6 +794,8 @@ int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
        char *event = NULL, *sub = NULL, *match;
        int ret;
 
+       if (!tr)
+               return -ENOENT;
        /*
         * The buf format can be <subsystem>:<event-name>
         *  *:<event-name> means any event by that name.
@@ -826,7 +828,6 @@ int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
 
        return ret;
 }
-EXPORT_SYMBOL_GPL(ftrace_set_clr_event);
 
 /**
  * trace_set_clr_event - enable or disable an event
@@ -851,6 +852,32 @@ int trace_set_clr_event(const char *system, const char *event, int set)
 }
 EXPORT_SYMBOL_GPL(trace_set_clr_event);
 
+/**
+ * trace_array_set_clr_event - enable or disable an event for a trace array.
+ * @tr: concerned trace array.
+ * @system: system name to match (NULL for any system)
+ * @event: event name to match (NULL for all events, within system)
+ * @enable: true to enable, false to disable
+ *
+ * This is a way for other parts of the kernel to enable or disable
+ * event recording.
+ *
+ * Returns 0 on success, -EINVAL if the parameters do not match any
+ * registered events.
+ */
+int trace_array_set_clr_event(struct trace_array *tr, const char *system,
+               const char *event, bool enable)
+{
+       int set;
+
+       if (!tr)
+               return -ENOENT;
+
+       set = (enable == true) ? 1 : 0;
+       return __ftrace_set_clr_event(tr, NULL, system, event, set);
+}
+EXPORT_SYMBOL_GPL(trace_array_set_clr_event);
+
 /* 128 should be much more than enough */
 #define EVENT_BUF_SIZE         127
 
@@ -2035,6 +2062,12 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
        trace_create_file("format", 0444, file->dir, call,
                          &ftrace_event_format_fops);
 
+#ifdef CONFIG_TRACE_EVENT_INJECT
+       if (call->event.type && call->class->reg)
+               trace_create_file("inject", 0200, file->dir, file,
+                                 &event_inject_fops);
+#endif
+
        return 0;
 }