tracing: fix config options to not show when automatically selected
[safe/jmp/linux-2.6] / kernel / trace / trace_event_profile.c
index 199de9c..5b5895a 100644 (file)
 int ftrace_profile_enable(int event_id)
 {
        struct ftrace_event_call *event;
+       int ret = -EINVAL;
 
-       for_each_event(event) {
-               if (event->id == event_id)
-                       return event->profile_enable(event);
+       mutex_lock(&event_mutex);
+       list_for_each_entry(event, &ftrace_events, list) {
+               if (event->id == event_id) {
+                       ret = event->profile_enable(event);
+                       break;
+               }
        }
+       mutex_unlock(&event_mutex);
 
-       return -EINVAL;
+       return ret;
 }
 
 void ftrace_profile_disable(int event_id)
 {
        struct ftrace_event_call *event;
 
-       for_each_event(event) {
-               if (event->id == event_id)
-                       return event->profile_disable(event);
+       mutex_lock(&event_mutex);
+       list_for_each_entry(event, &ftrace_events, list) {
+               if (event->id == event_id) {
+                       event->profile_disable(event);
+                       break;
+               }
        }
+       mutex_unlock(&event_mutex);
 }