MMFMWK-8297: ISI: return error when ISI chan0 is busy
authorGuoniu.Zhou <guoniu.zhou@nxp.com>
Mon, 22 Oct 2018 07:19:27 +0000 (15:19 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
When ISI channel0 is used to recevice camera data, it can
not be used to mem2mem. So return -EBUSY error code when
user try to use them at the same time.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit c6d5bf866819deaaf4900ae47d575c5a36d30a66)

drivers/media/platform/imx8/mxc-isi-m2m.c

index 900a323..47f1def 100644 (file)
@@ -396,6 +396,11 @@ static int mxc_isi_m2m_open(struct file *file)
 
        dev_dbg(dev, "%s, ISI%d\n", __func__, mxc_isi->id);
 
+       if (atomic_read(&mxc_isi->open_count) > 0) {
+               dev_err(dev, "%s: ISI channel[%d] is busy\n", __func__, mxc_isi->id);
+               return -EBUSY;
+       }
+
        if (mutex_lock_interruptible(&mxc_isi->lock))
                return -ERESTARTSYS;
        mxc_ctx = kzalloc(sizeof(*mxc_ctx), GFP_KERNEL);