extern void perf_tp_event(u16 event_type, u64 count, void *record,
                          int entry_size, struct pt_regs *regs,
                          struct hlist_head *head, int rctx,
-                         struct task_struct *task, struct perf_event *event);
+                         struct task_struct *task);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
 
 static inline void
 perf_trace_buf_submit(void *raw_data, int size, int rctx, u16 type,
                       u64 count, struct pt_regs *regs, void *head,
-                      struct task_struct *task, struct perf_event *event)
+                      struct task_struct *task)
 {
-       perf_tp_event(type, count, raw_data, size, regs, head, rctx, task, event);
+       perf_tp_event(type, count, raw_data, size, regs, head, rctx, task);
 }
 #endif
 
 
                }
        }
        perf_tp_event(call->event.type, count, raw_data, size, regs, head,
-                     rctx, task, NULL);
+                     rctx, task);
 }
 EXPORT_SYMBOL_GPL(perf_trace_run_bpf_submit);
 
 void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
                   struct pt_regs *regs, struct hlist_head *head, int rctx,
-                  struct task_struct *task, struct perf_event *event)
+                  struct task_struct *task)
 {
        struct perf_sample_data data;
+       struct perf_event *event;
 
        struct perf_raw_record raw = {
                .frag = {
 
        perf_trace_buf_update(record, event_type);
 
-       /* Use the given event instead of the hlist */
-       if (event) {
+       hlist_for_each_entry_rcu(event, head, hlist_entry) {
                if (perf_tp_event_match(event, &data, regs))
                        perf_swevent_event(event, count, &data, regs);
-       } else {
-               hlist_for_each_entry_rcu(event, head, hlist_entry) {
-                       if (perf_tp_event_match(event, &data, regs))
-                               perf_swevent_event(event, count, &data, regs);
-               }
        }
 
        /*
 
 perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,
                          struct ftrace_ops *ops, struct pt_regs *pt_regs)
 {
-       struct perf_event *event;
        struct ftrace_entry *entry;
        struct hlist_head *head;
        struct pt_regs regs;
 
        entry->ip = ip;
        entry->parent_ip = parent_ip;
-       event = container_of(ops, struct perf_event, ftrace_ops);
        perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, TRACE_FN,
-                             1, ®s, head, NULL, event);
+                             1, ®s, head, NULL);
 
 #undef ENTRY_SIZE
 }
 
        memset(&entry[1], 0, dsize);
        store_trace_args(sizeof(*entry), &tk->tp, regs, (u8 *)&entry[1], dsize);
        perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
-                             head, NULL, NULL);
+                             head, NULL);
 }
 NOKPROBE_SYMBOL(kprobe_perf_func);
 
        entry->ret_ip = (unsigned long)ri->ret_addr;
        store_trace_args(sizeof(*entry), &tk->tp, regs, (u8 *)&entry[1], dsize);
        perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
-                             head, NULL, NULL);
+                             head, NULL);
 }
 NOKPROBE_SYMBOL(kretprobe_perf_func);
 #endif /* CONFIG_PERF_EVENTS */
 
 
        perf_trace_buf_submit(rec, size, rctx,
                              sys_data->enter_event->event.type, 1, regs,
-                             head, NULL, NULL);
+                             head, NULL);
 }
 
 static int perf_sysenter_enable(struct trace_event_call *call)
        }
 
        perf_trace_buf_submit(rec, size, rctx, sys_data->exit_event->event.type,
-                             1, regs, head, NULL, NULL);
+                             1, regs, head, NULL);
 }
 
 static int perf_sysexit_enable(struct trace_event_call *call)
 
        }
 
        perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
-                             head, NULL, NULL);
+                             head, NULL);
  out:
        preempt_enable();
 }