This patch exports pfm_ctxsw() in perfmon_ctxsw.c
so that perfmon_cell module can call it.
And it adds Null check to pfm_ctxsw();

Signed-off-by: Takashi Yamamoto <TakashiA.Yamamoto@jp.sony.com>
---
 perfmon/perfmon_ctxsw.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/perfmon/perfmon_ctxsw.c
+++ b/perfmon/perfmon_ctxsw.c
@@ -36,6 +36,7 @@
  * 02111-1307 USA
  */
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/perfmon_kern.h>
 
 /*
@@ -348,8 +349,12 @@ void pfm_ctxsw(struct task_struct *prev,
 
 	now = sched_clock();
 
-	ctxp = prev->pfm_context;
-	ctxn = next->pfm_context;
+	ctxp = NULL;
+	ctxn = NULL;
+	if (prev)
+		ctxp = prev->pfm_context;
+	if (next)
+		ctxn = next->pfm_context;
 
 	if (ctxp)
 		__pfm_ctxswout_thread(prev, ctxp, now);
@@ -370,3 +375,4 @@ void pfm_ctxsw(struct task_struct *prev,
 	pfm_stats_inc(ctxsw_count);
 	pfm_stats_add(ctxsw_ns, sched_clock() - now);
 }
+EXPORT_SYMBOL_GPL(pfm_ctxsw);
