media: atomisp: Drop streamoff_mutex
authorHans de Goede <hdegoede@redhat.com>
Sat, 3 Sep 2022 21:42:53 +0000 (23:42 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 08:09:30 +0000 (10:09 +0200)
Now that __atomisp_streamoff() no longer drops isp->mutex to cancel
the watchdog timer, the streamoff_mutex is no longer necessary to
avoid multiple streamoffs racing with each other.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_fops.c
drivers/staging/media/atomisp/pci/atomisp_internal.h
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_v4l2.c

index e1b213b..531bbd6 100644 (file)
@@ -822,7 +822,6 @@ static int atomisp_release(struct file *file)
        if (!isp)
                return -EBADF;
 
-       mutex_lock(&isp->streamoff_mutex);
        mutex_lock(&isp->mutex);
 
        dev_dbg(isp->dev, "release device %s\n", vdev->name);
@@ -909,7 +908,6 @@ done:
                                     V4L2_SEL_TGT_COMPOSE, 0,
                                     &clear_compose);
        mutex_unlock(&isp->mutex);
-       mutex_unlock(&isp->streamoff_mutex);
 
        return v4l2_fh_release(file);
 }
index 2279d45..f3ef840 100644 (file)
@@ -239,12 +239,6 @@ struct atomisp_device {
        /* Purpose of mutex is to protect and serialize use of isp data
         * structures and css API calls. */
        struct mutex mutex;
-       /*
-        * Serialise streamoff: mutex is dropped during streamoff to
-        * cancel the watchdog queue. MUST be acquired BEFORE
-        * "mutex".
-        */
-       struct mutex streamoff_mutex;
 
        unsigned int input_cnt;
        struct atomisp_input_subdev inputs[ATOM_ISP_MAX_INPUTS];
index 8991575..6d84a7e 100644 (file)
@@ -1872,7 +1872,6 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
                atomisp_subdev_source_pad(vdev), asd->index);
 
        lockdep_assert_held(&isp->mutex);
-       lockdep_assert_held(&isp->streamoff_mutex);
 
        if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
                dev_dbg(isp->dev, "unsupported v4l2 buf type\n");
@@ -2081,11 +2080,9 @@ static int atomisp_streamoff(struct file *file, void *fh,
        struct atomisp_device *isp = video_get_drvdata(vdev);
        int rval;
 
-       mutex_lock(&isp->streamoff_mutex);
        mutex_lock(&isp->mutex);
        rval = __atomisp_streamoff(file, fh, type);
        mutex_unlock(&isp->mutex);
-       mutex_unlock(&isp->streamoff_mutex);
 
        return rval;
 }
index d55e8d3..4ab9185 100644 (file)
@@ -1482,7 +1482,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
        dev_dbg(&pdev->dev, "atomisp mmio base: %p\n", isp->base);
 
        mutex_init(&isp->mutex);
-       mutex_init(&isp->streamoff_mutex);
        spin_lock_init(&isp->lock);
 
        /* This is not a true PCI device on SoC, so the delay is not needed. */