IPP V1.003: fix deadlock bug when bliting
authorchenli <chenli@rock-chips.com>
Mon, 26 Nov 2012 00:42:46 +0000 (08:42 +0800)
committerchenli <chenli@rock-chips.com>
Mon, 26 Nov 2012 00:42:46 +0000 (08:42 +0800)
drivers/staging/rk29/ipp/rk29-ipp.c

index 1d35cbc497de08fe32931ef22aae49900926aa22..4680dce38ad4a8d6125484964e245a129cbdcec3 100644 (file)
 #include <linux/slab.h>\r
 \r
 #ifdef CONFIG_ARCH_RK29\r
-#define IPP_VERSION "rk29-ipp 1.002"\r
+#define IPP_VERSION "rk29-ipp 1.003"\r
 #endif\r
 \r
 #ifdef CONFIG_ARCH_RK30\r
-#define IPP_VERSION "rk30-ipp 1.002"\r
+#define IPP_VERSION "rk30-ipp 1.003"\r
 #endif\r
 \r
 //#define IPP_TEST\r
@@ -961,11 +961,16 @@ int ipp_blit_async(const struct rk29_ipp_req *req)
        //If IPP is busy now,wait until it becomes idle\r
        mutex_lock(&drvdata->mutex);\r
        {\r
-               dmac_inv_range((const void*)&idle_condition,(const void*)&idle_condition+4);\r
-               //printk("idle_condition = %d\n",idle_condition);\r
-               wait_event_interruptible(blit_wait_queue, idle_condition);\r
+               ret = wait_event_interruptible(blit_wait_queue, idle_condition);\r
+               \r
+               if(ret < 0)\r
+               {\r
+                       printk("ipp_blit_async wait_event_interruptible=%d\n",ret);\r
+                       mutex_unlock(&drvdata->mutex);\r
+                       return ret;\r
+               }\r
+               \r
                idle_condition = 0;\r
-               dmac_clean_range((const void*)&idle_condition,(const void*)&idle_condition+4);\r
        }\r
        mutex_unlock(&drvdata->mutex);\r
 \r
@@ -980,17 +985,23 @@ static int ipp_blit_sync_real(const struct rk29_ipp_req *req)
 {\r
        int status;\r
        int wait_ret;\r
-\r
+       \r
        //printk("ipp_blit_sync -------------------\n");\r
 \r
        //If IPP is busy now,wait until it becomes idle\r
        mutex_lock(&drvdata->mutex);\r
        {\r
-               dmac_inv_range((const void*)&idle_condition,(const void*)&idle_condition+4);\r
-               //printk("idle_condition = %d\n",idle_condition);\r
-               wait_event_interruptible(blit_wait_queue, idle_condition);\r
+               status = wait_event_interruptible(blit_wait_queue, idle_condition);\r
+               \r
+               if(status < 0)\r
+               {\r
+                       printk("ipp_blit_sync_real wait_event_interruptible=%d\n",status);\r
+                       mutex_unlock(&drvdata->mutex);\r
+                       return status;\r
+               }\r
+               \r
                idle_condition = 0;\r
-               dmac_clean_range((const void*)&idle_condition,(const void*)&idle_condition+4);\r
+               \r
        }\r
        mutex_unlock(&drvdata->mutex);\r
 \r
@@ -1048,7 +1059,6 @@ static int ipp_blit_sync_real(const struct rk29_ipp_req *req)
        }\r
        drvdata->issync = false;\r
 \r
-\r
        //IPP is idle, wake up the wait queue\r
        //printk("ipp_blit_sync done ----------------\n");\r
        status = drvdata->ipp_result;\r
@@ -1200,7 +1210,6 @@ static irqreturn_t rk29_ipp_irq(int irq,  void *dev_id)
        {\r
                //power off\r
                schedule_delayed_work(&drvdata->power_off_work, msecs_to_jiffies(50));\r
-                       \r
                drvdata->ipp_irq_callback(drvdata->ipp_result);\r
                \r
                //In the case of async call ,we wake up the wait queue here\r
@@ -1767,7 +1776,7 @@ static int __devinit ipp_drv_probe(struct platform_device *pdev)
 \r
 #ifdef IPP_TEST\r
        INIT_DELAYED_WORK(&d_work, ipp_test_work_handler);\r
-       schedule_delayed_work(&d_work, msecs_to_jiffies(35000));\r
+       schedule_delayed_work(&d_work, msecs_to_jiffies(65000));\r
 #endif\r
 \r
        return 0;\r