]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00176159 video: ipuv3-fb: change to timeout semaphore to wait on irq.
authorZhang Jiejing <jiejing.zhang@freescale.com>
Tue, 6 Mar 2012 06:47:57 +0000 (14:47 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:11:09 +0000 (14:11 +0200)
change to timeout semaphore to wait on irq.

use no timeout semaphore have below issues:
1. since fbmem.c will hold the console_lock() before call PAN_DISPLAY ioictl,
 if have wrong happens on IPU, IRQ not come, any log printk will not ouput,
 it will become like a system hang, and developer don't know what's wrong.

2. semaphore don't have timeout, here we can't know irq not come,
  so hang it infintly.
3. semaphore lock and unlock in different context is a dangous operation.

To fix these issue, use timedout version to wait on irq.
But for better coding stly to align Kernel Coding Style Doc,
better use complete to wait on irq, use semaphre little ugly.

Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
drivers/video/mxc/mxc_ipuv3_fb.c

index 6434d82d09412e42dd687d934265a9c4e42dfbe7..9252537aa7eed434c38c1b25c2f3308896549728 100644 (file)
@@ -925,7 +925,11 @@ static int mxcfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                        else
                                ipu_alp_ch_irq = IPU_IRQ_BG_ALPHA_SYNC_EOF;
 
-                       down(&mxc_fbi->alpha_flip_sem);
+                       if (down_timeout(&mxc_fbi->alpha_flip_sem, HZ/2)) {
+                               dev_err(fbi->device, "timeout when waitting for alpha flip irq\n");
+                               retval = -ETIMEDOUT;
+                               break;
+                       }
 
                        mxc_fbi->cur_ipu_alpha_buf =
                                                !mxc_fbi->cur_ipu_alpha_buf;
@@ -1317,7 +1321,10 @@ mxcfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
                }
        }
 
-       down(&mxc_fbi->flip_sem);
+       if (down_timeout(&mxc_fbi->flip_sem, HZ/2)) {
+               dev_err(info->device, "timeout when waitting for flip irq\n");
+               return -ETIMEDOUT;
+       }
 
        mxc_fbi->cur_ipu_buf = (++mxc_fbi->cur_ipu_buf) % 3;
        mxc_fbi->cur_ipu_alpha_buf = !mxc_fbi->cur_ipu_alpha_buf;