Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / kernel / gcov / base.c
index 9b22d03..b358a80 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/mutex.h>
 #include "gcov.h"
 
-static struct gcov_info *gcov_info_head;
 static int gcov_events_enabled;
 static DEFINE_MUTEX(gcov_lock);
 
@@ -34,7 +33,7 @@ void __gcov_init(struct gcov_info *info)
 
        mutex_lock(&gcov_lock);
        if (gcov_version == 0) {
-               gcov_version = info->version;
+               gcov_version = gcov_info_version(info);
                /*
                 * Printing gcc's version magic may prove useful for debugging
                 * incompatibility reports.
@@ -45,8 +44,7 @@ void __gcov_init(struct gcov_info *info)
         * Add new profiling data structure to list and inform event
         * listener.
         */
-       info->next = gcov_info_head;
-       gcov_info_head = info;
+       gcov_info_link(info);
        if (gcov_events_enabled)
                gcov_event(GCOV_ADD, info);
        mutex_unlock(&gcov_lock);
@@ -81,6 +79,18 @@ void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
 }
 EXPORT_SYMBOL(__gcov_merge_delta);
 
+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_ior);
+
+void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_time_profile);
+
 /**
  * gcov_enable_events - enable event reporting through gcov_event()
  *
@@ -91,13 +101,15 @@ EXPORT_SYMBOL(__gcov_merge_delta);
  */
 void gcov_enable_events(void)
 {
-       struct gcov_info *info;
+       struct gcov_info *info = NULL;
 
        mutex_lock(&gcov_lock);
        gcov_events_enabled = 1;
+
        /* Perform event callback for previously registered entries. */
-       for (info = gcov_info_head; info; info = info->next)
+       while ((info = gcov_info_next(info)))
                gcov_event(GCOV_ADD, info);
+
        mutex_unlock(&gcov_lock);
 }
 
@@ -112,25 +124,23 @@ static int gcov_module_notifier(struct notifier_block *nb, unsigned long event,
                                void *data)
 {
        struct module *mod = data;
-       struct gcov_info *info;
-       struct gcov_info *prev;
+       struct gcov_info *info = NULL;
+       struct gcov_info *prev = NULL;
 
        if (event != MODULE_STATE_GOING)
                return NOTIFY_OK;
        mutex_lock(&gcov_lock);
-       prev = NULL;
+
        /* Remove entries located in module from linked list. */
-       for (info = gcov_info_head; info; info = info->next) {
+       while ((info = gcov_info_next(info))) {
                if (within(info, mod->module_core, mod->core_size)) {
-                       if (prev)
-                               prev->next = info->next;
-                       else
-                               gcov_info_head = info->next;
+                       gcov_info_unlink(prev, info);
                        if (gcov_events_enabled)
                                gcov_event(GCOV_REMOVE, info);
                } else
                        prev = info;
        }
+
        mutex_unlock(&gcov_lock);
 
        return NOTIFY_OK;