gpu: pvr: refactor dump_process_info
authorImre Deak <imre.deak@nokia.com>
Wed, 9 Feb 2011 07:58:13 +0000 (09:58 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:03 +0000 (21:43 +0300)
Split out from the function the part getting the process data based on
the current SHX HW memory context. This functionality will be needed by
an upcoming patch.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/sgxinit.c

index 0896c32..c1a15a4 100644 (file)
@@ -648,24 +648,36 @@ static void dump_edm(struct PVRSRV_SGXDEV_INFO *sdev)
 #endif
 }
 
-static void dump_process_info(struct PVRSRV_DEVICE_NODE *dev)
+static struct PVRSRV_PER_PROCESS_DATA *find_cur_proc_data(
+                                       struct PVRSRV_DEVICE_NODE *dev)
 {
        struct PVRSRV_SGXDEV_INFO *dev_info = dev->pvDevice;
        u32 page_dir = readl(dev_info->pvRegsBaseKM +
                                EUR_CR_BIF_DIR_LIST_BASE0);
        struct BM_CONTEXT *bm_ctx;
        struct RESMAN_CONTEXT *res_ctx = NULL;
+       struct PVRSRV_PER_PROCESS_DATA *proc_data = NULL;
 
        bm_ctx = bm_find_context(dev->sDevMemoryInfo.pBMContext, page_dir);
        if (bm_ctx)
                res_ctx = pvr_get_resman_ctx(bm_ctx);
 
-       if (res_ctx) {
+       if (res_ctx)
+               proc_data = pvr_get_proc_by_ctx(res_ctx);
+
+       return proc_data;
+}
+
+static void dump_process_info(struct PVRSRV_DEVICE_NODE *dev)
+{
+       struct PVRSRV_PER_PROCESS_DATA *proc;
+
+       proc = find_cur_proc_data(dev);
+
+       if (proc) {
                struct task_struct *tsk;
-               struct PVRSRV_PER_PROCESS_DATA *proc;
                int pid;
 
-               proc = pvr_get_proc_by_ctx(res_ctx);
                pid = proc->ui32PID;
                rcu_read_lock();
                tsk = pid_task(find_vpid(pid), PIDTYPE_PID);